You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat!: Use binary envelopes for operation lower_func encoding (#2447)
~~Blocked by #2445 due to errors with the hugr-py model encoding.~~
Changes the format used to encode the `LowerFunc::FixedHugr`s in an
extension's operation from string-encoded envelopes to base64-encoded
binary envelopes.
Adds an `envelope::serde_with::AsBinaryEnvelope` wrapper similar to
`AsStringEnvelope`, that lets us include base64-encoded envelopes in a
serde definition.
- hugr-py does not yet support loading binary envelopes, so we ignore
lowering functions when loading extensions.
- The deserializer can still load older extensions. We check for the
envelope magic numbers on the encoded string and skip the base64
deserialization if found.
- Older hugr versions will **not** be able to read extensions encoded
this way, and will fail with an "invalid magic" error.
- The schema does not change, since the hugr field is still a `string`.
drive-by: Adds a custom deserializing function for `LowerFunc` so errors
found while decoding the fixed hugr get communicated back up. The
default `serde` derive produced an opaque "no variants match" error due
to using `#[serde(untagged)]`.
BREAKING CHANGE: Lowering functions in extension operations are now
encoded as binary envelopes. Older hugr versions will error out when
trying to load them.
Copy file name to clipboardExpand all lines: specification/schema/hugr_schema_live.json
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -581,6 +581,7 @@
581
581
"type": "object"
582
582
},
583
583
"FixedHugr": {
584
+
"description": "Fixed HUGR used to define the lowering of an operation.\n\nArgs:\n extensions: Extensions used in the HUGR.\n hugr: Base64-encoded HUGR envelope.",
Copy file name to clipboardExpand all lines: specification/schema/hugr_schema_strict_live.json
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -581,6 +581,7 @@
581
581
"type": "object"
582
582
},
583
583
"FixedHugr": {
584
+
"description": "Fixed HUGR used to define the lowering of an operation.\n\nArgs:\n extensions: Extensions used in the HUGR.\n hugr: Base64-encoded HUGR envelope.",
Copy file name to clipboardExpand all lines: specification/schema/testing_hugr_schema_live.json
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -581,6 +581,7 @@
581
581
"type": "object"
582
582
},
583
583
"FixedHugr": {
584
+
"description": "Fixed HUGR used to define the lowering of an operation.\n\nArgs:\n extensions: Extensions used in the HUGR.\n hugr: Base64-encoded HUGR envelope.",
Copy file name to clipboardExpand all lines: specification/schema/testing_hugr_schema_strict_live.json
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -581,6 +581,7 @@
581
581
"type": "object"
582
582
},
583
583
"FixedHugr": {
584
+
"description": "Fixed HUGR used to define the lowering of an operation.\n\nArgs:\n extensions: Extensions used in the HUGR.\n hugr: Base64-encoded HUGR envelope.",
0 commit comments