ferranbt / fastssz

Fast Ethereum2.0 SSZ encoder/decoder
MIT License
73 stars 44 forks source link

bug(generator): cannot generate when go 1.18+ generics are used. #159

Open itsdevbear opened 4 months ago

itsdevbear commented 4 months ago

Generator blows up really hard on generics, would be nice to handle.

letonchanh commented 3 months ago

Currently, decodeASTStruct does not consider TypeParams of ast.TypeSpec. That's why structs with generics cannot be generated. To support generics, I think fastssz also needs to decode TypeParams.

ferranbt commented 3 months ago

Do you have an elaborated set of examples on how do you want to use generics? I am trying to understand the full scope. The example in #160 should be fairly easy to handle in itself.

ferranbt commented 3 months ago

This is a fix to encode the struct in #160.