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

Modify blueprint schema to properly handle pairs #938

Closed
wants to merge 1 commit into from

Conversation

MicroProofs
Copy link
Member

No description provided.

@MicroProofs MicroProofs requested a review from a team as a code owner May 12, 2024 17:50
Copy link
Member

@KtorZ KtorZ left a comment

Choose a reason for hiding this comment

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

Good catch, that's an oversight. However the implementation isn't quite correct here; Pair cannot live at the same level as other Data variants, those are meant to faithfully describe Data.

@@ -92,6 +92,7 @@ pub enum Data {
Integer,
Bytes,
List(Items<Data>),
Pair(Declaration<Data>, Declaration<Data>),
Copy link
Member

Choose a reason for hiding this comment

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

This isn't right, a Pair cannot be a Plutus' Data.

@@ -297,18 +298,11 @@ impl Annotated<Schema> {
// make all types abide by this convention.
let data = match definitions.try_lookup(&generic).cloned() {
Some(Annotated {
annotated: Schema::Data(Data::List(Items::Many(xs))),
annotated: Schema::Data(Data::Pair(left, right)),
Copy link
Member

Choose a reason for hiding this comment

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

The schema here should likely be Pair, not Data

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm I'll have to look into the conversion from Schema::Pair into a Schema of Data to handle the Map case

Data::Pair(left, right) => {
let mut s = serializer.serialize_struct("Pair", 2)?;
s.serialize_field("dataType", "list")?;
s.serialize_field("items", &[left, right])?;
Copy link
Member

Choose a reason for hiding this comment

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

That doesn't match CIP-0057´s specification though 😶

@KtorZ KtorZ closed this in e2bc3a9 May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🚀 Released
Development

Successfully merging this pull request may close these issues.

2 participants