Giter VIP home page Giter VIP logo

Comments (7)

MariusVanDerWijden avatar MariusVanDerWijden commented on August 28, 2024

Ahh I had an interface defined in one of the files

type Serialize interface {
    Marshal() []byte
}

Which broke code generation, might be cool to just ignore these.

from fastssz.

ferranbt avatar ferranbt commented on August 28, 2024

Please check #53, it should fix the issue.

Besides, I would recommend you to use the '--objs' flag to filter for specific objects and skip everything else. Is there any reason why you would use your own Serialize interface instead of using the Marshaler interface from the library?

from fastssz.

MariusVanDerWijden avatar MariusVanDerWijden commented on August 28, 2024

Nah, I already removed the Serialize interface, was just an artifact from before

from fastssz.

MariusVanDerWijden avatar MariusVanDerWijden commented on August 28, 2024

The only problem I have right now is that I cannot ssz a common.Hash which is a type alias for [32]byte{} from geth

from fastssz.

ferranbt avatar ferranbt commented on August 28, 2024

In the spectests there is an example of an external reference, you can use --include to link the path of the common package such that that sszgen knows the type.

from fastssz.

MariusVanDerWijden avatar MariusVanDerWijden commented on August 28, 2024

Now I get the following error:

panic: interface conversion: ast.Expr is *ast.Ident, not *ast.BasicLit

goroutine 1 [running]:
main.getObjLen(0xc000158db0, 0x0)
        /home/matematik/ethereum/fastssz/sszgen/main.go:890 +0x1a6
main.(*env).parseASTFieldType(0xc00013be28, 0xc000016258, 0x4, 0x0, 0x0, 0x5e4468, 0xc000158db0, 0xffffffffffffffff, 0x0, 0xc00019f9d0)
        /home/matematik/ethereum/fastssz/sszgen/main.go:930 +0x1051
main.(*env).encodeItem(0xc00013be28, 0xc000016258, 0x4, 0x0, 0x0, 0x0, 0x203000, 0x203000)
        /home/matematik/ethereum/fastssz/sszgen/main.go:825 +0x34f
main.(*env).parseASTFieldType(0xc00013be28, 0xc000016246, 0xa, 0x0, 0x0, 0x5e4b88, 0xc00000c0d8, 0x44a72c, 0x0, 0x5a1860)
        /home/matematik/ethereum/fastssz/sszgen/main.go:1034 +0x565
main.(*env).parseASTStructType(0xc00013be28, 0xc000016230, 0xb, 0xc00000c0f0, 0x6ec901, 0x5e4900, 0xc000062340)
        /home/matematik/ethereum/fastssz/sszgen/main.go:862 +0x168
main.(*env).encodeItem(0xc00013be28, 0xc000016230, 0xb, 0x0, 0x0, 0xc0001aa800, 0x0, 0x0)
        /home/matematik/ethereum/fastssz/sszgen/main.go:823 +0x12f
main.(*env).generateIR(0xc00013be28, 0xc0000762a0, 0xc00013bdc8)
        /home/matematik/ethereum/fastssz/sszgen/main.go:794 +0x835
main.encode(0x7fff8c0d026e, 0x10, 0x6eb740, 0x0, 0x0, 0x0, 0x0, 0xc000056340, 0x1, 0x1, ...)
        /home/matematik/ethereum/fastssz/sszgen/main.go:95 +0x205
main.main()
        /home/matematik/ethereum/fastssz/sszgen/main.go:43 +0x3cb
exit status 2

from fastssz.

MariusVanDerWijden avatar MariusVanDerWijden commented on August 28, 2024

It's because we use a constant instead of a literal in the type definition of common.Hash.
E.g.

const HashLength = 32
type Hash [HashLength]byte

Don't know if that is something that the code generation should handle correctly. But I think the eth2 spec also uses constants for declaring the size of some fields so it might be needed, idk.

Edit. Just realized with ssz-size and ssz-max this is not needed

from fastssz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.