Comments (7)
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.
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.
Nah, I already removed the Serialize interface, was just an artifact from before
from fastssz.
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.
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.
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.
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)
- MerkleizeWithMixin's performance is terrible when a large `ssz-max` is specified HOT 1
- Add support for variables HOT 1
- How does raw ssz vector ser/dser? HOT 14
- Unused import HOT 1
- ssz HashTreeRoot is different in window 386 environment HOT 6
- Cannot generate nested structs with ssz'able things from outside the current package. HOT 4
- How does raw ssz list ser/dser? HOT 2
- `HashWalker` interface is missing `PutUint64Array` HOT 2
- Incorrect HashTreeRoot of vectors HOT 4
- `ssz.ExtendUint32` and `hh.AppendUint32` undefined error in the generated code HOT 2
- bug(generator): Generator cannot infer `ssz-size` for fixed length bytes. HOT 1
- If a struct tag exists, the generate doesn't implicitly recognize SSZ-able types HOT 1
- bug(generator): Type Alias on byteslice causes generator to panic HOT 3
- bug(generator): cannot generate when go 1.18+ generics are used. HOT 3
- support custom marshal/unmarshal/hashroot HOT 5
- incompatibility between zeroHashes and custom hash function HOT 2
- Const sized byte array fail to generate HOT 1
- Generating with --include produces unsused imports HOT 1
- External reference to `[]byte` type does not import package in generated code
- Dynamic struct tags to support different chain specifications
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastssz.