eqlabs / pathfinder

A Starknet full node written in Rust
https://eqlabs.github.io/pathfinder/
Other
633 stars 236 forks source link

Move `SerializeForVersion` into the super module so it can be implemented on `common` types #2181

Open sistemd opened 3 months ago

sistemd commented 3 months ago

Currently, SerializeForVersion is defined in the dto::serialization module. For this reason, we need various odd wrappers to serialize common types, such as this TxnHash type, as well as many others added in https://github.com/eqlabs/pathfinder/pull/2178.

Instead, we can move SerializeForVersion into the dto module, allowing us to implement it directly on the common types and avoid the wrappers.

sistemd commented 3 months ago

Admittedly, another reason for these wrappers is to enable this blanket impl, but it's probably more elegant to make a Serde wrapper that delegates to serde::Deserialize and get rid of the blanket impl.