ralexstokes / ssz-rs

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

fix bug when serializing a "newtype" SSZ wrapper #18

Closed ralexstokes closed 2 years ago

ralexstokes commented 2 years ago

the SimpleSerialize derive proc-macro supports the "new type" rust pattern, e.g.

#[derive(SimpleSerialize)]
struct LocalType(ssz_rs::SomeType)

// specialize behavior of `ssz_rs::SomeType` via `impl LocalType`

@realbigsean found a bug where the generated ser/de code treated this "new type" wrapper as a SSZ container of one element, instead of treating it "transparently" (see rust's repr(transparent) or serde's serde(transparent) attributes for the idea)

this PR fixes the bug by, in fact, serde'ing transparently