-
Notifications
You must be signed in to change notification settings - Fork 0
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
Specify requirements for Valid and Deterministic Encodings #57
Specify requirements for Valid and Deterministic Encodings #57
Conversation
Add Serialization Considerations section and specify - Valid CCF Encoding Requirements - Deterministic CCF Encoding Requirements These requirements are necessary and have an impact on CCF codec speed and memory use. Prior formats didn't specify requirements for validity or deterministic encoding. Updated benchmark comparisons (coming soon) should be viewed with this in mind. For example, sorting (as part of deterministic encoding) isn't free.
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.
Great work! This is very clear and makes sense 👍
Only got some questions regarding the "inferred" types.
Under "Serialization Considerations", create a section to clarify encoding of Cadence types and values. - Mention that for compactness, CCF encoding skips Cadence type encoding when type can be inferred. - Describe CCF encoding when type can be inferred by using array of String to illustrate. - Describe CCF encoding when type cannot be inferred by using array of AnyStruct to illustrate. - Remove 4 bullet points in "Deterministic CCF Encoding Requirements" because they are replaced by the new section, "Cadence Types and Values Encoding".
In "Valid CCF Encoding Requirements", add a line mentioning CCF encodings must comply with "CCF Specified in CDDL Notation" section of this document.
Mention all parameter lists MUST be unique as suggested by Bastian.
Co-authored-by: Bastian Müller <bastian@axiomzen.co>
Elements MUST be unique in `restricted-type` or `restricted-type-value`.
Mention that: - `restricted-type.restrictions` MUST be sorted by restriction's `cadence-type-id`. - `restricted-type-value.restrictions` MUST be sorted by restriction's `cadence-type-id`. Thanks @dsainati1 for answering question about Cadence restricted type!
@turbolent @j1010001 thanks for the meeting today! Feel free to add comments here from our meeting. I think we're on the same page about everything and just need to document it for clarity. I'll incorporate feedback from our meeting into CCF specs and continue ongoing work on CCF codec. |
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.
Great work!
Added the notes from our sync
Update "Deterministic CCF Encoding Requirements": - Separate bullet points for field names and parameter lists because they are unrelated. - Generalize to "all parameter lists" instead of just listing a specific case. - Add `function-value.parameters` as another example of parameter list. Co-authored-by: Bastian Müller <bastian@axiomzen.co>
A CCF-based protocol for encoding transaction arguments might want to specify that encoders MUST produce deterministic encodings. Whereas, a CCF-based protocol for encoding script return values might want to specify that encoders don't need to produce deterministic encodings if the recipient doesn't care about values being encoded deterministically. Co-authored-by: Bastian Müller <bastian@axiomzen.co>
For compactness, use more concise examples for omitting type info. Co-authored-by: Bastian Müller <bastian@axiomzen.co>
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.
Nice! 👌
Add Serialization Considerations section and specify
Replace "ABRIDGED DRAFT" with "DRAFT" in Status of this Document section.
These requirements are necessary and have an impact on CCF codec speed and memory use.
Prior formats (JSON-Cadence Data Interchange and CBF) didn't specify requirements for validity or deterministic encoding. Updated benchmark comparisons (coming soon) should be viewed with this in mind. For example, sorting (as part of deterministic encoding) isn't free.