ferranbt / fastssz

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

Add support for non-literal array lengths #108

Closed henridf closed 1 year ago

henridf commented 1 year ago

The following example fails due to the array length not being a *ast.BasicLit.

package badone

const ArrayLength = 1

type S struct {
    Arr [ArrayLength]byte `ssz-size:"10"`
}

It would be handy to be able to support such cases (this is coming up when sszgen-annotating geth's Header struct).

ferranbt commented 1 year ago

I will try to get something rolling on this for this week.