-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
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.
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>), |
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.
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)), |
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.
The schema here should likely be Pair, not Data
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.
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])?; |
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.
That doesn't match CIP-0057´s specification though 😶
No description provided.