ralexstokes / ssz-rs

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

refactor ser/de into `Serializable` trait without merkle caps #97

Closed ralexstokes closed 1 year ago

ralexstokes commented 1 year ago

following up on #92 -- there is desire to separate the merkleization capability from the ser/de capability for SSZ types

previously, all of these capabilities where coupled under the SimpleSerialize trait.

now, the ser/de stuff has been split into a Serializable trait and SimpleSerialize simply requires that along w/ the merkle trait Merkleized

while doing this refactor, it became clear that the Sized trait could be bundled and it doesn't really make much sense on it's own

beyond that, there are various refactors to limit the scope of traits required to their bare minimum.

this should support future proc macro work that allows a user to choose just the serde and forgo the merkle functionality

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (e498c7a) 74.18% compared to head (57306d1) 74.18%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #97 +/- ## ======================================= Coverage 74.18% 74.18% ======================================= Files 17 17 Lines 829 829 ======================================= Hits 615 615 Misses 214 214 ``` | [Files Changed](https://app.codecov.io/gh/ralexstokes/ssz-rs/pull/97?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alex+Stokes) | Coverage Δ | | |---|---|---| | [ssz-rs/src/array.rs](https://app.codecov.io/gh/ralexstokes/ssz-rs/pull/97?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alex+Stokes#diff-c3N6LXJzL3NyYy9hcnJheS5ycw==) | `26.86% <ø> (ø)` | | | [ssz-rs/src/bitlist.rs](https://app.codecov.io/gh/ralexstokes/ssz-rs/pull/97?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alex+Stokes#diff-c3N6LXJzL3NyYy9iaXRsaXN0LnJz) | `79.16% <ø> (ø)` | | | [ssz-rs/src/bitvector.rs](https://app.codecov.io/gh/ralexstokes/ssz-rs/pull/97?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alex+Stokes#diff-c3N6LXJzL3NyYy9iaXR2ZWN0b3IucnM=) | `82.95% <ø> (ø)` | | | [ssz-rs/src/boolean.rs](https://app.codecov.io/gh/ralexstokes/ssz-rs/pull/97?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alex+Stokes#diff-c3N6LXJzL3NyYy9ib29sZWFuLnJz) | `91.30% <ø> (ø)` | | | [ssz-rs/src/de.rs](https://app.codecov.io/gh/ralexstokes/ssz-rs/pull/97?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alex+Stokes#diff-c3N6LXJzL3NyYy9kZS5ycw==) | `78.18% <ø> (ø)` | | | [ssz-rs/src/uint.rs](https://app.codecov.io/gh/ralexstokes/ssz-rs/pull/97?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alex+Stokes#diff-c3N6LXJzL3NyYy91aW50LnJz) | `88.31% <ø> (ø)` | | | [ssz-rs/src/union.rs](https://app.codecov.io/gh/ralexstokes/ssz-rs/pull/97?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alex+Stokes#diff-c3N6LXJzL3NyYy91bmlvbi5ycw==) | `55.17% <ø> (ø)` | | | [ssz-rs/src/utils.rs](https://app.codecov.io/gh/ralexstokes/ssz-rs/pull/97?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alex+Stokes#diff-c3N6LXJzL3NyYy91dGlscy5ycw==) | `50.00% <ø> (ø)` | | | [ssz-rs/src/list.rs](https://app.codecov.io/gh/ralexstokes/ssz-rs/pull/97?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alex+Stokes#diff-c3N6LXJzL3NyYy9saXN0LnJz) | `77.10% <100.00%> (ø)` | | | [ssz-rs/src/ser.rs](https://app.codecov.io/gh/ralexstokes/ssz-rs/pull/97?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alex+Stokes#diff-c3N6LXJzL3NyYy9zZXIucnM=) | `70.27% <100.00%> (ø)` | | | ... and [1 more](https://app.codecov.io/gh/ralexstokes/ssz-rs/pull/97?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alex+Stokes) | |

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