EspressoSystems / hotshot-query-service

Generic query service for HotShot applications
https://espressosystems.github.io/hotshot-query-service/
GNU General Public License v3.0
5 stars 1 forks source link

Implement Versioned Deserialize #643

Open nomaxg opened 5 months ago

nomaxg commented 5 months ago

The query data types (LeafQueryData, BlockQueryData, etc) need to implement Deserialize to work nicely with surf-disco. I would suggest adding a version field to each of these as the first field (again, we can always pull this version from the database whenever we need to construct one of these) and manually implementing deserialize to first read the version, then the remaining fields, using Deserialize for normal fields and DeserializeForVersion for HotShot types.

This manual deserialize implementation might be pretty verbose and repetitive, so ideally we could find some way to do it with serde attributes or potentially write our own macro