fjl / gencodec

Command gencodec generates marshaling methods for Go struct types.
MIT License
55 stars 27 forks source link

Temp Check: SSZ #21

Open itsdevbear opened 8 months ago

itsdevbear commented 8 months ago

@fjl are you open to adding SSZ here?

I can implement.

itsdevbear commented 8 months ago

can either homeroll or use fastssz

fjl commented 8 months ago

Yeah, why not. Question is mostly, how it will be done. Does fastssz support encoding by reflection?

fjl commented 8 months ago

Looking at fastssz, it doesn't seem so easy. ssz.Marshal expects a Marshaler as argument, which is supposed to perform the encoding and also should be able to compute the encoded size. So I guess your idea would be to generate a Marshaler implementation? Then you're basically reimplementing the sszgen tool.

fjl commented 8 months ago

The main purpose of gencodec is features such as 'required fields' and the 'override type'. If you need these, I think you'd be much better off just implementing them in sszgen.

itsdevbear commented 7 months ago

@fjl we are playing around with something internally, will share our findings in the next couple weeks