ferranbt / fastssz

Fast Ethereum2.0 SSZ encoder/decoder
MIT License
80 stars 46 forks source link

generator: int & int64 & uint - not supported ? #180

Open iurii-ssv opened 1 month ago

iurii-ssv commented 1 month ago

I'm trying to use generator and encounter the following error(s):

ferranbt commented 4 weeks ago

Can you share a repro of the struct that fails?

iurii-ssv commented 4 weeks ago

What's also curious is that latest version seems to be 0.1.3 while 0.1.4 seems to have been out for a while now as per https://github.com/ferranbt/fastssz/tags

➜ go install github.com/ferranbt/fastssz/sszgen@latest
...
➜ sszgen version
0.1.3

looking more into it - I believe the issue is only showing up when struct fields start with capital letter (and have int or int64 or uint type):

package storage

//go:generate sszgen -path ./shares.go --objs storageShare

type storageShare struct {
    // intExample working fine
    intExample int
    // int64Example working fine
    int64Example int64
    // uintExample working fine
    uintExample uint

    // IntExample not working fine
    IntExample int
    // Int64Example not working fine
    Int64Example int64
    // UintExample not working fine
    UintExample uint

    Layer2Struct layer2Struct
}

type layer2Struct struct {
    // intExample working fine
    intExample int
    // int64Example working fine
    int64Example int64
    // uintExample working fine
    uintExample uint

    // IntExample not working fine
    IntExample int
    // Int64Example not working fine
    Int64Example int64
    // UintExample not working fine
    UintExample uint
}
ferranbt commented 3 weeks ago

I was able to reproduce it. There are two issues: