ralexstokes / ssz-rs

Implementation of ethereum's `ssz`
Apache License 2.0
102 stars 40 forks source link

Derive serialize and deserialize #92

Closed zsluedem closed 1 year ago

zsluedem commented 1 year ago
  1. Adding derive only for Serialize and Deserialize Serializable 2. relaxing the type constraint on List<T, N> and Vec<T, N> so that pure Serialize and Deserialize could be used directly too.
ralexstokes commented 1 year ago

do you have an example use case where you would only want the serde functionality and the merkle stuff is a strict problem?

zsluedem commented 1 year ago

do you have an example use case where you would only want the serde functionality and the merkle stuff is a strict problem?

Hm... I am working on the p2p part of the rust bundler of erc4337. The p2p spec requires ssz encoding for these types and the merkle stuff is not needed here currently.

I implemented the encoding part for UserOp and didn't implement for merkle function but I still want to derive the serialize function only for more types.

From my point of perspective, it makes sense to decompose the serialize function with merkle function and it would be more extensible.

codecov[bot] commented 1 year ago

Codecov Report

Patch and project coverage have no change.

Comparison is base (0a763ee) 77.44% compared to head (653fe9c) 77.44%.

:exclamation: Current head 653fe9c differs from pull request most recent head 8d1ebbf. Consider uploading reports for the commit 8d1ebbf to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #92 +/- ## ======================================= Coverage 77.44% 77.44% ======================================= Files 17 17 Lines 869 869 ======================================= Hits 673 673 Misses 196 196 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

ralexstokes commented 1 year ago

@zsluedem did some work on main to simplify the type constraints and also split off the serialization bit from the merkle bit

would love to see a PR for your updates to the proc macro here (may be easier to just cherry-pick to a new PR)

zsluedem commented 1 year ago

Thanks