-
Notifications
You must be signed in to change notification settings - Fork 157
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
Conversation
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.
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" |
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 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 | ||
) |
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 thought that we wanted the deserialization to be backwards compatible.
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.
Yes, I am an idiot and totally forgot about this. Will fix.
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.
you are anything but that! and thanks again for taking this one on!
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.
@nc6 this is really awesome, thank you. I made two comments, one about names 😱 and one about backwards compatibility.
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. |
d188e99
to
5621e17
Compare
5621e17
to
daa602d
Compare
@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 |
; other types of metadata... | ||
}] | ||
] |
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.
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.
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.
Visible changes: * IntersectMBO/cardano-ledger#1993 * IntersectMBO/cardano-ledger#2021
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>
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>
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>
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>
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>
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>
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>
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>
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>
Additional comments per commit.