-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add a "HUGR envelope" binary format #1862
Comments
I am pro starting to use the |
name: "HUGR bitcode" too misleading? |
Look nice! Would the idea be to keep this around as the standard envelope indefinitely? That's good for future-proofing, but I would be wary of promising retro-compatibility of the format. The The magic number and 64b header look fine. Check
"hugr bitcode" would be the serialized |
While it's useful yes. When I say "Tools are not required to support every encoding", this is intended to include that we are allowed to drop json support. Note that self-versioning serialisations (json + hugr-model) should continue to encode their versions in the payload.
I think Seyon was suggesting "hugr bitcode" as an alternative to HUGR envelope. I don't love "hugr bitcode", because the payload may be textual (json or maybe hugr-model s-expressions in the future). But I don't feel strongly, happy for others to decide. |
Great idea. For the magic number we could use the ASCII of |
We will at some point be transitioning to serialising via hugr-model by-default.
One of the primary motivations for this change is reducing the size of serialised HUGRs.
To ease the transition, and to mitigate teething problems with hugr-model I suggest we specify and implement a "HUGR envelope" binary format before switching to hugr-model. This envelope would initially be able to contain one of:
I suggest the envelope format be:
The magic number is used by tools to identify a HUGR envelope. It should be randomly generated, and then sanity checked by googling for binary,decimal,hexadecimal representations.
The 64 bit header specifies how the payload should be decoded. Initially it must be one of 4 values: 1, 2, 3, 4. These correspond to the encodings specified above. 0 is invalid because lots of mistakes involve writing 0. One could also include a version here, or leave it for later. We can easily expand the set of allowed headers as time goes on. If we find we need a larger header we should create a new magic number.
Tools are not required to support every encoding, e.g. one imagines zstd support should be behind a cargo feature, and hugr-model currently is behind a cargo feature. Tools should fail gracefully with helpful errors when they see a known-but-unsupported encoding.
As part of this ticket
Questions:
.hugr
?The text was updated successfully, but these errors were encountered: