-
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
[Specifications] Transformation artifacts #3
Comments
Thank you Thomas for sharing these elements that early. I'm confident in our ability to iterate rapidly and formalize an interesting specification for these artifacts. Choice of serialization formatI am not 100% aligned with your reasoning and its output on the choice of the file format. You say that the file should be human-editable, which I disagree with. To me, the file will most likely be generated by the SDK (parsing code, special comments and options) which is most likely to enable the creation of rich artifacts, and allowing for or encouraging human edition will most likely open the door to more troubles than allow for interesting use cases. In this context, I think that JSON could be a better option :
|
Thank you for the quick feedback @PhilippeMts . Choice of serialization format
I agree with that affirmation. But I still think that we need an "easy" way for developers to document their transformation and associate that documentation to the metadata. We can use JSON as metadata format and maybe associate a dedicated command to insert some documentation from a markdown file to the JSON object. What do you think of that proposal ?
|
Thanks Thomas. I think we are on our way to find a consensus on each of these points. Choice of serialization format
I of course agree, but think that the primary source of trustful information should always be the source code (as it is obviously a required component of the compilation process). Your solution seems to be a good one to ensure some level of data validation while opening the door to the scenario you describe, but I would assign it a lower priority than the default path to the generation of this artifact.
|
Thank you again for your feedback ! I tried to assemble a better spec by taking into account your review. I am posting it here. Please feel free to comment ! Artifacts generationSecond proposal Metadata fileFormat: JSON Base JSON definition would be an object with only one key : Transformation objectsThe transformation object would have name composed as InputsKey: The first property for a description would be So that {
"type": "object",
"properties": {
"a": {
"type": "string"
},
"b": {
"type": "string"
}
}
} would become: {
"type": "array",
"prefixItems": [
{
"type": "object",
"properties": {
"a": {
"type": "string"
},
"b": {
"type": "string"
}
}
},
{
"type": "bool"
}
]
} OutputsKey: Same as inputs SampleLets say that we have the following functions signatures in our code: pub fn add(values: Values) -> u32 {
...
}
pub fn substract(values: Values) -> u32 {
...
} with the following structure: struct Values {
a: u32,
b: u32
} The following json would be generated {
"title": "mylib",
"version": "1.0.0",
"properties": {
"transformations": {
"type": "array",
"description": "All transformation available in mylib",
"prefixItems": [
{
"title": "mylib::add",
"type": "object",
"properties": {
"inputs": {
"type": "array",
"description": "Input payload for the add transformation",
"prefixItems": [
{ "$ref": "#/$defs/values" }
]
},
"outputs": {
"type": "array",
"description": "Output payload for the add transformation",
"prefixItems": [
{
"type": "number",
"description": "Result of the addition"
}
]
}
}
},
{
"title": "mylib::subtract",
"type": "object",
"properties": {
"inputs": {
"type": "array",
"description": "Input payload for the subtract transformation",
"prefixItems": [
{ "$ref": "#/$defs/values" }
]
},
"outputs": {
"type": "array",
"description": "Output payload for the subtract transformation",
"prefixItems": [
{
"type": "number",
"description": "Result of the subtraction"
}
]
}
}
}
]
}
},
"$defs": {
"values": {
"type": "object",
"description": "Value structure, containing the two values to add",
"properties": {
"a": {
"type": "number",
"description": "First value"
},
"b": {
"type": "number",
"description": "Second value"
}
}
}
}
}
|
I will here answer questions from you previous comment: Choice of serialization formatN/A
|
Sorry Thomas for spending too much time since your last comment. I need to take a step back to really frame what we are currently working on. Here is the result of my personal reflexion on this frame. As you will understand, elements of answer to your last comment will logically come in a second comment of mine. Context: previous elements from the design under constructionReferencesIPLD Schema documentation### Standard metadata
Metadata objects are basically made of key-free mappings to maximize flexibility at the schema-level. Here are some
recommended keys.
#### Transformation metadata
| Key | Value | Example |
|---|---|---|
| `name` | Package name. | `date-and-time` |
| `version` | Package version. | `1.0.1` |
#### Wet execution metadata
| Key | Value | Example |
|---|---|---|
| `time` | Date and time of the execution in ISO 8601 format. | `2021-07-14T10:12:37Z` | Schemata themselves## -----
## Metadata
## -----
##
## In the Holium Framework, optional metadata schemas include links to the kinds they refer to, and not the other way
## around. This design choice ensures that core objects' content identifiers (CIDs) do not depend on more volatile
## metadata. ## TransformationMetadata_v0 adds metadata to some transformation bytecode or some data source (the `transformation`
## field would be null in the latter case).
type TransformationMetadata_v0 struct {
transformation nullable &TransformationBytecode
metadata {String:String}
} representation tuple Key insights
Why transformation handles should be indices, not stringsMany advantages for integer indices instead of string handles to identify a transformation inside a compiled package bytecode.
Recommendation : use the What should and shouldn't contain the metadata object stored on IPFS/IPLD ?Most elements shared in the Context section are still true and ensure a coherent higher architecture. Thus, once stored on IPLD, it still seems interesting for the metadata object to be made of 3 parts :
However, to really meets expected insights shared earlier, a To meet expected insights, what we need is broadly:
Why not including links to the bytecode inside the metadata fieldIn fact, it comes very handy two state a clear distinction between two worlds:
The strenght of this distinction is verified in its ability to use the same structure for the metadata field, either to describe transformation metadata or data source metadata (same structure, one linked to bytecode in the world of identifiable resources, the other not). Why using CBOR to store the 3 fields (including the
|
This comment tries to provide a follow-up to last pending question in the context described in the last comment. Main interrogationI feel like we may not be aligned on what kind of objects we are dealing with:
From my point of view, most of a metadata object should be a simple JSON object. When we want to document a transformation or data source with names, long documentation, version numbers, we only need JSON objects. And to standardize and document these objects, we need JSON schemas. One part of this metadata could benefit from being a bit more than just a JSON object : transformation signatures. Indeed, we can envision a will to use JSON schema keys like However, we are not sure yet of the complexity we would like to implement in transformation signatures, and in any case, JSON schemas are still valid JSON objects. We can thus start with only the first part (JSON objects validated by JSON schemas) and delay the implementation of the second part (transformation signatures as JSON schemas validated by meta schemas). This is my recommendation. I would recommend to:
First intuition of a metadata schemaIn that context, here is a first intuition of a JSON schema for these transformation / data source metadata. {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://holium.org/holium-transformation-metadata.schema.json",
"title": "Holium Transformation Metadata",
"description": "Metadata complementary to some transformation bytecode or data source in the Holium Framework.",
"type": "object",
"properties": {
"author": {
"type": "string",
"description": "The author of the package."
},
"name": {
"type": "string",
"description": "The name of the package."
},
"version": {
"type": "string",
"description": "The version of the package. Semantic versioning should be preferred."
},
"transformations": {
"type": "array",
"description": "Ordered list of all transformations included in the package.",
"items": {
"$ref": "#/$defs/transformation"
}
}
},
"$defs": {
"transformation": {
"type": "object",
"description": "Metadata related to a transformation.",
"properties": {
"name": {
"type": "string",
"description": "The name of the transformation."
},
"description": {
"type": "string",
"description": "This description documenting the use of the transformation."
},
"deprecated": {
"type": "boolean",
"description": "Specifies that the transformation has been deprecated."
},
"inputs": {
"type": "array",
"description": "Input part of a transformation signature.",
"items": {
"$ref": "#/$defs/parameter"
}
},
"outputs": {
"type": "array",
"description": "Output part of a transformation signature.",
"items": {
"$ref": "#/$defs/parameter"
}
}
}
},
"parameter": {
"type": "object",
"description": "Describes an input or output parameter.",
"properties": {
"name": {
"type": "string",
"description": "The name of the parameter."
},
"description": {
"type": "string",
"description": "A long description of the parameter"
},
"holiumType": {
"description": "The type of the parameter.",
"oneOf": [
{
"$ref": "#/$defs/scalarParameterType"
},
{
"$ref": "#/$defs/recursiveParameterType"
}
]
}
}
},
"scalarParameterType": {
"type": "string",
"enum": [
"null",
"boolean",
"number",
"string",
"binData"
]
},
"recursiveParameterType": {
"type": "array",
"items": {
"$ref": "#/$defs/parameter"
}
}
}
} NB : ExampleUsing your examples, and omitting the {
"$schema": "https://holium.org/holium-transformation-metadata.schema.json",
"name": "mylib",
"version": "1.0.0",
"transformations": [
{
"name": "add",
"description": "Description of the add transformation",
"inputs": [
{
"name": "values",
"description": "Input payload for the add transformation",
"holiumType": [
{
"name": "a",
"description": "First value",
"holiumType": "number"
},
{
"name": "b",
"description": "Second value",
"holiumType": "number"
}
]
}
],
"outputs": [
{
"description": "Output payload for the subtract transformation",
"holiumType": "number"
}
]
}
]
} If the ticket about signatures as JSON schemas was implemented, we could also add a Other comments on your suggestionsComment #0
I don't think we need One may or may not use Comment #1
I don't quite get the reasoning behind this assertion. To me, names should be free fields, with one name for the package, and one name for transformations, all unformatted to start with. Comment #2
Not sure what tuple you are talking about as I can't find one in your example. |
Thanks for the nice answers Philippe ! I think we will be able to finalize these specifications 1rst postWhy transformation handles should be indices, not strings
Ok, that sounds good to me. I wanted to do so w/ my first proposition but by reading what you had written I thaught you were against it. What should and shouldn't contain the metadata object stored on IPFS/IPLD ?👍 Why not including links to the bytecode inside the metadata field👍 Why using CBOR to store the 3 fields (including the
|
Thanks Thomas. Here are some of the (hopefully) last answers. 1rst postShould JSON Schema be used to describe metadata, or CDDL, or BSON schema,… ?Sub-rationale : why having a type system that includes bin data ?
To be sure that I was clear enough, I support the integration of such a type in our system. So we agree. (I'm not sure the section of the specifications you link to really relate to this problematic though, as the Conclusion
Neat! 📐 |
When compiling rust code to generate the wasm bytecode we should generates some artifacts to retrieve metadata from the base code. The format for the metadata should be human readable and editable as some documentation might have to be completed for example.
Here is a first proposal to open the discussion:
Artifacts generation
Deux fichiers : bytecode & metadata
Metadata file
Format: TOML
Objects
Metadata
Contains metadata to associate to a transformation bytecode
Structure
Structure represents custom types defined by the transformation developer
Transformation
Transformation represents a function in the library
Fields
Sample
The text was updated successfully, but these errors were encountered: