-
Notifications
You must be signed in to change notification settings - Fork 96
fix: make IDL/Candid decoding of options spec compliant #981
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
size-limit report 📦
|
Co-authored-by: Kaia Peacock <[email protected]>
Co-authored-by: Kaia Peacock <[email protected]>
4 tasks
Contributor
Author
|
FTR, this is how I hand crafted the tests using Motoko, in case we want to add more: |
Contributor
Author
|
More tests that check decoding of embedded options with more to decode following: |
max-dfinity
approved these changes
Mar 20, 2025
krpeacock
approved these changes
Mar 20, 2025
1 task
github-merge-queue bot
pushed a commit
to dfinity/nns-dapp
that referenced
this pull request
Mar 25, 2025
# Motivation 1. Keep our dependencies up to date. 2. A bug in [agent-js](dfinity/icp-js-core#981) that caused issues decoding variants from candid # Changes 1. Ran `npm i @dfinity/agent@latest`. # Tests 1. Existing tests pass. # Todos - [ ] Add entry to changelog (if necessary). not necessary
Contributor
Author
|
Hurrah! |
4 tasks
This was referenced Apr 10, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Bring Candid decoding of
opttypes up to Candid spec:In particular, when decoding at an
opttype:opttype, decode its payload at the expected content type(as before).
nullwire type as IDL valuenull(i.e. JS[]).reservedwire type, defaulting to IDL valuenull(i.e. JS[]).provided the decoded value is valid at the expected variant type. Otherwise, default to
null(i.e. JS[]).nullorreservedor (nested)opt, return IDL valuenull(i.e. JS[]).null,reservedor nestedopt:allow decoding of the non-optioned value
vasopt v(JS[v*]) if compatible withthe expected content type; if incompatible, return IDL value
null(JS[]).How Has This Been Tested?
See additional candid tests in PR.
Checklist: