-
Notifications
You must be signed in to change notification settings - Fork 109
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
IDL Variant decoding: Make use of type description ACT-111 #697
Conversation
6fb32a4
to
7e2cf58
Compare
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.
Looks good. Maybe we can revisit this later.
@@ -3989,24 +3989,36 @@ module Serialization = struct | |||
) | |||
| Variant vs -> | |||
with_composite_typ (-21l) (fun get_typ_buf -> | |||
ReadBuf.read_leb128 env get_typ_buf ^^ G.i Drop ^^ | |||
(* Find the tag *) | |||
let (set_n, get_n) = new_local env "len" in |
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.
n
or "len"
, not clear.
E.else_trap_with env "IDL error: variant index out of bounds" ^^ | ||
|
||
(* Zoom past the previous entries *) | ||
get_tagidx ^^ from_0_to_n env (fun _ -> | ||
ReadBuf.read_leb128 env get_typ_buf ^^ G.i Drop ^^ |
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.
Why not call the C-rts internal routine to advance over (s)leb128 in buffer? It would need to get exposed, and it is not yet merged to main. But it could potentially avoid allocation of BigInts
(hashes are big).
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.
Right, I thought about doing that, not sure why I didn’t. Let me do a PR right away.
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.
Oh, we have to wait for #687 to do that.
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.
Above:
and it is not yet merged to main
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.
Sorry, didn’t read carefully, my fault.
## Changelog for motoko-base: Branch: next-moc Commits: [dfinity/motoko-base@8fd23fa7...a3dd04eb](dfinity/motoko-base@8fd23fa...a3dd04e) * [`cee15564`](dfinity/motoko-base@cee1556) feat: add `isReplicated` to `ExperimentalInternetComputer` ([dfinity/motoko-base#694](https://togithub.com/dfinity/motoko-base/issues/694)) * [`c9a08167`](dfinity/motoko-base@c9a0816) feat: add `Error.isRetryPossible`, a predicate for non-fatal messaging errors ([dfinity/motoko-base#692](https://togithub.com/dfinity/motoko-base/issues/692)) * [`6246b654`](dfinity/motoko-base@6246b65) feat: make `replyDeadline` an optional return type ([dfinity/motoko-base#693](https://togithub.com/dfinity/motoko-base/issues/693)) * [`1a381b99`](dfinity/motoko-base@1a381b9) Motoko 0.14.3 * [`756855bc`](dfinity/motoko-base@756855b) chore: amend the 0.14.3 changelog ([dfinity/motoko-base#697](https://togithub.com/dfinity/motoko-base/issues/697))
## Changelog for motoko-base: Branch: next-moc Commits: [dfinity/motoko-base@8fd23fa7...a3dd04eb](dfinity/motoko-base@8fd23fa...a3dd04e) * [`cee15564`](dfinity/motoko-base@cee1556) feat: add `isReplicated` to `ExperimentalInternetComputer` ([dfinity/motoko-base#694](https://togithub.com/dfinity/motoko-base/issues/694)) * [`c9a08167`](dfinity/motoko-base@c9a0816) feat: add `Error.isRetryPossible`, a predicate for non-fatal messaging errors ([dfinity/motoko-base#692](https://togithub.com/dfinity/motoko-base/issues/692)) * [`6246b654`](dfinity/motoko-base@6246b65) feat: make `replyDeadline` an optional return type ([dfinity/motoko-base#693](https://togithub.com/dfinity/motoko-base/issues/693)) * [`1a381b99`](dfinity/motoko-base@1a381b9) Motoko 0.14.3 * [`756855bc`](dfinity/motoko-base@756855b) chore: amend the 0.14.3 changelog ([dfinity/motoko-base#697](https://togithub.com/dfinity/motoko-base/issues/697))
No description provided.