-
Notifications
You must be signed in to change notification settings - Fork 339
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
[BUG] risc0_zkvm serde fails to deserialize if the serialized type differs #1742
Comments
Hey @zvolin! I took a quick look at this and it's looks like the root cause is that risc0's It seems like fixing this should be relatively straightforward, but I couldn't get the |
As for the This trick seems to be used in Tendermint because they only care about supporting |
Note: to build on main you'll need to install
|
I've read the serde data model and I'm not sure I agree.
This doesn't answer the question directly, but more or less I understand it that Visitor can accept different types, and mapping don't need to be straighforward. There is even example of serializing path as one enum variant and deserializing into other. I always thought of |
Bug Report
The title is pretty generic but I don't know how to express that cleaner. It's pretty common to use some tricks when implementing
Serialize
andDeserialize
by hand. One such trick is to serializeString
and deserialize&str
, to avoid double allocations.This example will fail:
Another pattern I'm aware of (eg. tendermint-rs does that) is to serialize
T
but deserializeOption<T>
and have some fallback in case it's not present.Expected behavior
It would be cool if risc0_zkvm would support such tricks as they're not so uncommon in the ecosystem. Ciborium is an example of binary serializer that supports both of the above, and bincode seems to support the
&str
trick.Your Environment
The text was updated successfully, but these errors were encountered: