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

CAD-2147: Support additional scripts in structured metadata. #1993

Merged
merged 4 commits into from
Nov 22, 2020
Merged

Conversation

nc6
Copy link
Contributor

@nc6 nc6 commented Nov 17, 2020

Additional comments per commit.

Copy link
Contributor

@uroboros uroboros left a comment

Choose a reason for hiding this comment

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

looks good! - also looks like a painful rebase in my near future :)

-- | Raw, un-memoised metadata type
data MetadataRaw era = MetadataRaw
{ mdScriptPreimages :: !(StrictSeq (Core.Script era)),
-- | Unstructured metadata "blob"
Copy link
Contributor

Choose a reason for hiding this comment

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

so sorry to bike-shed a word in a comment, and a variable name. I myself had been using the word "unstructured" for this component, but @dcoutts let me know that actually we've been elsewhere been calling this "structured metadata" and this will confuse folks. mdScriptPreimages is great, though. :)

( Ann (RecD MetadataRaw)
<*! D (sequence <$> decodeStrictSeq fromCBOR)
<*! Ann From
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought that we wanted the deserialization to be backwards compatible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I am an idiot and totally forgot about this. Will fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

you are anything but that! and thanks again for taking this one on!

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@JaredCorduan JaredCorduan left a comment

Choose a reason for hiding this comment

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

@nc6 this is really awesome, thank you. I made two comments, one about names 😱 and one about backwards compatibility.

@nc6
Copy link
Contributor Author

nc6 commented Nov 17, 2020

I should point out that the failing CI here is expected; I'm waiting for Ryan's PR on generalising the tests to fix things.

@nc6
Copy link
Contributor Author

nc6 commented Nov 20, 2020

@redxaxder Please note that in the last commit I changed the CDDL format to match the encoder, because it seemed completely non-obvious to me how to use Coders to represent the suggested format. But perhaps you or @TimSheard know how to do this easily, in which case I'd welcome a commit changing the representation (or just advice as to how to do this). This can either be part of this PR or a follow-up

; other types of metadata...
}]
]
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're changing it to a dense encoding then the labels 0: and 1: are just informative rather than part of the encoding. IIRC some code generators emit these as names. So these could be more descriptive.

@redxaxder
Copy link
Contributor

@redxaxder Please note that in the last commit I changed the CDDL format to match the encoder, because it seemed completely non-obvious to me how to use Coders to represent the suggested format. But perhaps you or @TimSheard know how to do this easily, in which case I'd welcome a commit changing the representation (or just advice as to how to do this). This can either be part of this PR or a follow-up

Your chosen encoding here is actually smaller than the one before. (In the case where there are two kinds of metadata, which is where we are). I think it might we worth talking about longer term plans for this.

Introduce a 'ValidateMetadata' class which operates across eras.
Currently tests are still failing, since it may be easier to operate
this atop of the generalised test generation framework.
This covers CAD-2147, and adds support for adding additional scripts to
the metadata in a structured way.
- Round-tripping of MA-era Metadata
- Check that Shelley-era metadata deserialises as MA-era.
@nc6 nc6 merged commit c418c12 into master Nov 22, 2020
@iohk-bors iohk-bors bot deleted the nc/cad-2147 branch November 22, 2020 20:20
mrBliss added a commit to IntersectMBO/cardano-node that referenced this pull request Dec 1, 2020
dcoutts pushed a commit to IntersectMBO/cardano-node that referenced this pull request Dec 1, 2020
Visible changes:
* IntersectMBO/cardano-ledger#1993
* IntersectMBO/cardano-ledger#2021

One of the changes in Allegra over Shelley is the notion of transaction
auxiliary data. We retrospectively define tx metadata to be part of the
auxiliary data where in the Shelley era this consists only of the
existing tx metadata.

But from the Allegra era the auxiliary data contains both the tx
metadata and also auxiliary scripts. So where we previously hashed the
tx metadata, we now hash the auxiliary data.

Take the opportunity to refactor the tx metadata representation and
conversion functions to fit better with the new scheme.

Also take the opportunity to tidy up the imports in the Query module
since we have some very similarly-named type classes.

Co-Authored by: Duncan Coutts <duncan@well-typed.com>
dcoutts added a commit to IntersectMBO/cardano-node that referenced this pull request Dec 1, 2020
Visible changes:
* IntersectMBO/cardano-ledger#1993
* IntersectMBO/cardano-ledger#2021

One of the changes in Allegra over Shelley is the notion of transaction
auxiliary data. We retrospectively define tx metadata to be part of the
auxiliary data where in the Shelley era this consists only of the
existing tx metadata.

But from the Allegra era the auxiliary data contains both the tx
metadata and also auxiliary scripts. So where we previously hashed the
tx metadata, we now hash the auxiliary data.

Take the opportunity to refactor the tx metadata representation and
conversion functions to fit better with the new scheme.

Also take the opportunity to tidy up the imports in the Query module
since we have some very similarly-named type classes.

Co-authored-by: Duncan Coutts <duncan@well-typed.com>
iohk-bors bot added a commit to IntersectMBO/cardano-node that referenced this pull request Dec 1, 2020
2149: Update dependencies r=dcoutts a=mrBliss

Visible changes:
* IntersectMBO/cardano-ledger#1993
* IntersectMBO/cardano-ledger#2021

Co-authored-by: Thomas Winant <thomas@well-typed.com>
intricate pushed a commit to IntersectMBO/cardano-node that referenced this pull request Dec 1, 2020
Visible changes:
* IntersectMBO/cardano-ledger#1993
* IntersectMBO/cardano-ledger#2021

One of the changes in Allegra over Shelley is the notion of transaction
auxiliary data. We retrospectively define tx metadata to be part of the
auxiliary data where in the Shelley era this consists only of the
existing tx metadata.

But from the Allegra era the auxiliary data contains both the tx
metadata and also auxiliary scripts. So where we previously hashed the
tx metadata, we now hash the auxiliary data.

Take the opportunity to refactor the tx metadata representation and
conversion functions to fit better with the new scheme.

Also take the opportunity to tidy up the imports in the Query module
since we have some very similarly-named type classes.

Co-authored-by: Duncan Coutts <duncan@well-typed.com>
dcoutts added a commit to IntersectMBO/cardano-node that referenced this pull request Dec 1, 2020
Visible changes:
* IntersectMBO/cardano-ledger#1993
* IntersectMBO/cardano-ledger#2021

One of the changes in Allegra over Shelley is the notion of transaction
auxiliary data. We retrospectively define tx metadata to be part of the
auxiliary data where in the Shelley era this consists only of the
existing tx metadata.

But from the Allegra era the auxiliary data contains both the tx
metadata and also auxiliary scripts. So where we previously hashed the
tx metadata, we now hash the auxiliary data.

Take the opportunity to refactor the tx metadata representation and
conversion functions to fit better with the new scheme.

Also take the opportunity to tidy up the imports in the Query module
since we have some very similarly-named type classes.

Co-authored-by: Duncan Coutts <duncan@well-typed.com>
iohk-bors bot added a commit to IntersectMBO/cardano-node that referenced this pull request Dec 1, 2020
2149: Update dependencies r=dcoutts a=mrBliss

Visible changes:
* IntersectMBO/cardano-ledger#1993
* IntersectMBO/cardano-ledger#2021

Co-authored-by: Thomas Winant <thomas@well-typed.com>
Co-authored-by: Duncan Coutts <duncan@well-typed.com>
Co-authored-by: Luke Nadur <19835357+intricate@users.noreply.github.com>
newhoggy pushed a commit to IntersectMBO/cardano-api that referenced this pull request May 23, 2023
Visible changes:
* IntersectMBO/cardano-ledger#1993
* IntersectMBO/cardano-ledger#2021

One of the changes in Allegra over Shelley is the notion of transaction
auxiliary data. We retrospectively define tx metadata to be part of the
auxiliary data where in the Shelley era this consists only of the
existing tx metadata.

But from the Allegra era the auxiliary data contains both the tx
metadata and also auxiliary scripts. So where we previously hashed the
tx metadata, we now hash the auxiliary data.

Take the opportunity to refactor the tx metadata representation and
conversion functions to fit better with the new scheme.

Also take the opportunity to tidy up the imports in the Query module
since we have some very similarly-named type classes.

Co-authored-by: Duncan Coutts <duncan@well-typed.com>
newhoggy pushed a commit to IntersectMBO/cardano-cli that referenced this pull request May 24, 2023
Visible changes:
* IntersectMBO/cardano-ledger#1993
* IntersectMBO/cardano-ledger#2021

One of the changes in Allegra over Shelley is the notion of transaction
auxiliary data. We retrospectively define tx metadata to be part of the
auxiliary data where in the Shelley era this consists only of the
existing tx metadata.

But from the Allegra era the auxiliary data contains both the tx
metadata and also auxiliary scripts. So where we previously hashed the
tx metadata, we now hash the auxiliary data.

Take the opportunity to refactor the tx metadata representation and
conversion functions to fit better with the new scheme.

Also take the opportunity to tidy up the imports in the Query module
since we have some very similarly-named type classes.

Co-authored-by: Duncan Coutts <duncan@well-typed.com>
newhoggy pushed a commit to IntersectMBO/cardano-cli that referenced this pull request May 24, 2023
2149: Update dependencies r=dcoutts a=mrBliss

Visible changes:
* IntersectMBO/cardano-ledger#1993
* IntersectMBO/cardano-ledger#2021

Co-authored-by: Thomas Winant <thomas@well-typed.com>
Co-authored-by: Duncan Coutts <duncan@well-typed.com>
Co-authored-by: Luke Nadur <19835357+intricate@users.noreply.github.com>
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.

4 participants