-
Notifications
You must be signed in to change notification settings - Fork 148
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
Why does Program do not implement serde
?
#1660
Comments
Hi @tdelabro ! |
Hi @pefontana, I saw the So, what we ended up doing is the following: Adding our own custom de/serialization logic where we need it in the logic that uses your type, so that we can still implement
Yes, the |
@pefontana any news on this issue? |
This is becoming a problem in other repositories: starkware-libs/blockifier#1937 |
So the real issue is that this is not properly documented, am I correct? |
This is one thing. The other is that it prevents anyone downstream from deriving Serde on their types that contain |
I believe it can be implemented, what we can not do is |
We want |
The main reason for not implementing |
Thanks, @fmoletta for expressing clearly the issue here. Now if you have a Program, you can de/ser it freely and if you are dealing with a cairo0 file, you deserialize it into your intermediary struct that you then use to build an executable Program. Note that you still won't be able to go from a Program to a Cairo0Program. Only the other way around. I have understood the situation correctly and is this a viable answer to the problem? |
If I understand correctly this would involve creating a |
I think the idea allows for us ( |
Another weird thing: #[derive(Serialize, Deserialize)]
pub struct Reference {
...
#[serde(deserialize_with = "deserialize_value_address")]
#[serde(rename(deserialize = "value"))]
pub value_address: ValueAddress,
} Where the struct impl both In the same idea both |
My input would be to:
Then if someone still needs it for some reason, we can easily derive Serde onto the |
I think structs containing a 1 to 1 version of the compiled cairo programs should be standarized (like contract classes in starknet-api) so users don't have to depend on this crate for it |
@orizi ⬆️ |
we would also like to be able to stop using forks of blockifier, they're very hard to maintain over time |
@pefontana @Oppen @fmoletta Did you decide on a design? What is the ETA? |
In
vm/src/types/program.rs
:Program
does not implement the traits Serialize/Deserialize, but instead those two methods who do the same thing, only in a way that is not compatible with theserde
crate.Why? I break upstream usage of the traits. If I have a struct that contains a
Program
(likeblockifier::ContractClassV1Inner
), I cannot derive the correct trait onto it.Why not just implement the trait?
The text was updated successfully, but these errors were encountered: