# EPF6 - Week 12&13 Updates ## Summary 1. [PR merged](https://github.com/OffchainLabs/prysm/pull/15676) 2. Attended Community Grantee Call 8 3. [Protocol buffer](https://pkg.go.dev/google.golang.org/protobuf#section-readme) in Golang 4. The great hash tree root refactor ## Details ### 1. PR merged into Prysm Just my first PR merged into Prysm. It just adds the list analysis into the `AnalyzeObject` function. ### 2. Community Grantee Call 8 1 hour call distributed in 10-minute breakout rooms + 2 grantees presentations: - [tevm](https://www.tevm.sh/): Ethereum Node for Viem - an on-chain patents... ### 3. Protobuf Protocol Buffers are a language-neutral, platform-neutral extensible mechanism for serializing structured data. "*Protocol Buffers are a language-neutral, platform-neutral extensible mechanism for serializing structured data.*" Defined the following "Vector of Containers" `Vector[FixedNestedContainer, 10]`: ```protobuf message VectorOfContainers { repeated FixedNestedContainer containers = 1 [ (ethereum.eth.ext.ssz_size) = "10" ]; // Test: Vector[FixedNestedContainer, 10] } ``` Generated the ```bash protoc \ -I . \ -I ./proto \ -I ./third_party \ --go_out=paths=source_relative:./proto \ proto/ssz_query/ssz_query.proto ``` After having some issues with `ssz_size` and `ssz_max` tags I looked into Jun's previous updates: - [Week 10](https://hackmd.io/@junsong/BJ2O_hYFge): just a refresher of why to use custom types, mainly because SSZ can be used out of the Consensus Layer. - [Struct tags used in `sszgen`](https://hackmd.io/em5tvy3tQTew4Qmj780W_Q#Background-How-are-pbgo-files-generated-And-How-does-sszgen-works): helpful write-up that forward me into the right path: `./hack/update-go-pbs.sh` which depends on `findutils` and `goimports`. There were some troubles while doing this. After a few ups and downs, it worked. Probably, the `protobuf` version was not correct, [this](https://github.com/protocolbuffers/protobuf/issues/5376). To be honest, I thought `Bazel` would take care of all the dependencies so as to have "deterministic builds". Definitely, I’ll dedicate some time to learning Protocol Buffers in depth, since I haven’t worked with them yet and my knowledge of them is still very shallow. ### 4. The hash tree root GREAT refactor After these few weeks of coding, I got to know a little better Golang and the [merkleization flows in SSZ](https://github.com/ethereum/consensus-specs/blob/dev/ssz/simple-serialize.md#merkleization). With these new eyes, I spent a few hours refreshing my knowledge of both [fastssz](https://github.com/ferranbt/fastssz/tree/main) and [dynssz](https://github.com/pk910/dynamic-ssz/tree/master). At this point I know I should be re-using their work instead of innovating with handmade flows when I'm not a Golang master. For example, I was amazed by this single line of code: ```golang // Reset resets the Hasher obj func (h *Hasher) Reset() { h.buf = h.buf[:0] } ``` The simpler the code, the more powerful it is. I understand this as the cornerstone of efficient memory management // Truncates the buffer to length 0 while keeping its existing capacity and backing array. it does not free memory, no deletion of the underlying array ### Next steps - Continue the refactor