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

fix: icx-proxy panic when decoding a response to http_request #221

Merged
merged 2 commits into from
Jul 6, 2021

Conversation

ericswanson-dfinity
Copy link
Member

Candid 0.7.1 does not support decoding a Record into an IDLValue. We were using this in an unsupported way with Candid 0.6.x, but it doesn't work anymore.

So, this commit specifies the exact type of the streaming http response token. Unfortunately, this means that we will no longer support arbitrary token types, but this is the best that we can do until Candid supports generic types: dfinity/candid#245

Candid 0.7.1 does not support decoding a Record into an IDLValue.  We were using this in an unsupported way with Candid 0.6.x, but it doesn't work anymore.

So, this commit specifies the exact type of the streaming http response token.  Unfortunately, this means that we will no longer support arbitrary token types, but this is the best that we can do until Candid supports generic types: dfinity/candid#245
@paulyoung
Copy link
Contributor

Does this fix #203?

@ericswanson-dfinity
Copy link
Member Author

Does this fix #203?

Yes, I think it will. We were running into errors like thread 'tokio-runtime-worker' panicked at 'internal error: entered unreachable code', /sources/candid-0.7.1/src/types/subtype.rs:116:25

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.

LGTM

@ericswanson-dfinity ericswanson-dfinity merged commit c6543eb into main Jul 6, 2021
@ericswanson-dfinity ericswanson-dfinity deleted the ericswanson/streaming-concrete-token-type branch July 6, 2021 20:36
Daniel-Bloom-dfinity added a commit to Daniel-Bloom-dfinity/agent-rs that referenced this pull request Mar 7, 2022
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.
ericswanson-dfinity pushed a commit that referenced this pull request Mar 7, 2022
* feat: Remake tokens generic
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 `IDLValueVisitor`. This is a little bit of a hack, but it works.
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