Skip to content
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

feat: Re-genericize tokens #318

Merged
merged 5 commits into from
Mar 7, 2022

Conversation

Daniel-Bloom-dfinity
Copy link
Contributor

re: #221 #203

Turns out you can actually get around candid's limitation on IDLValue. It just takes some careful rejiggering.

First, use Reserved to match anything. This seems like a valid use of Reserved, and should basically always be supported.

Second, use deserialize_ignored_any to actually get all the content with our own visitor (really just a copy of IDLValueVisitor). This is a little bit of a hack, but it works.

re: dfinity#221 dfinity#203

Turns out you can actually get around candid's limitation on `IDLValue`. It just takes some careful rejiggering.

First, use `Reserved` to match anything. This seems like a valid use of `Reserved`, and should basically always be supported.

Second, use `deserialize_ignored_any` to actually get all the content with our own visitor (really just a copy of `IDLValueVisitor`). This is a little bit of a hack, but it works.
@Daniel-Bloom-dfinity
Copy link
Contributor Author

Should resolve this issue with streaming tokens.

Copy link
Contributor

@chenyan-dfinity chenyan-dfinity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting idea!

Is there a way to avoid the code duplication of IDLValueVisitor? Future candid changes may cause inconsistent behaviors in icx-proxy. Does it work if we expose IDLValueVisitor from the candid crate?

@Daniel-Bloom-dfinity
Copy link
Contributor Author

Interesting idea!

Is there a way to avoid the code duplication of IDLValueVisitor? Future candid changes may cause inconsistent behaviors in icx-proxy. Does it work if we expose IDLValueVisitor from the candid crate?

It should. I literally just copied the code of IDLValueVisitor and fixed the import paths, so an export should work just as well.

@ericswanson-dfinity ericswanson-dfinity merged commit db7886d into dfinity:main Mar 7, 2022
@Daniel-Bloom-dfinity Daniel-Bloom-dfinity deleted the dbloom/token branch March 18, 2022 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants