# EPF6 - Week 10 Updates
## tl;dr
- Added one more [write-up](https://hackmd.io/@junsong/By4LArZtxg) for analyzing `dynamic-ssz`.
- Resolved concerns and issues regarding my first [PR](https://github.com/OffchainLabs/prysm/pull/15588).
- Made `encoding/ssz/query` package agnostic to the types from Ethereum consensus layer.
## Details
### Project Research: `dynamic-ssz` from [@pk910](https://github.com/pk910)
Write-up: [Delving into dynamic-ssz (`dynssz`)](https://hackmd.io/@junsong/By4LArZtxg)
There are several SSZ implementation written in Go. Because Philip's [`dynamic-ssz`](https://github.com/pk910/dynamic-ssz) is the one that is now actively under construction, and as I'm a big fan of his work, I decided to delve into the library for my personal learning.
I concluded with [key takeaways](https://hackmd.io/@junsong/By4LArZtxg#Key-takeaways-for-SSZ-QL-implementation-and-Prysm-context) from his implementation, and I was quite relieved that he has shared similar concerns with me :). There are some challenging tasks like distinguishing 1) between `List` and `Bitlist`, and 2) between `uint256` and `[]byte with length of 32`. His implementation contains several tricky code to handle it as well as adding a custom struct tags for distinguishing.
### PR is under reviewing!

Radek suggested valuable comments and some questions about my [PR](https://github.com/OffchainLabs/prysm/pull/15588) and I replied to all the comments. I'm getting closer to writing more idiomatic Go 😆. There was a [comment](https://github.com/OffchainLabs/prysm/pull/15588#discussion_r2293569839) that I would like to discuss more...
### Decoupling the SSZ-QL package with Ethereum

As I started my PoC with `IndexedAttestationElectra`, most of the tests are based on that type, which is entangled with the type of Beacon Chain. SSZ can exist independently from Ethereum, and the SSZ-QL project also [aims the "generic" way](https://github.com/eth-protocol-fellows/cohort-six/blob/master/projects/ssz-ql-with-merkle-proofs.md#possible-challenges) to query and prove a path in an arbitrary SSZ object.
```protobuf!
syntax = "proto3";
package ssz_query;
import "proto/eth/ext/options.proto";
option go_package = "github.com/OffchainLabs/prysm/v6/proto/ssz_query";
// ===== FIXED-SIZE TEST CONTAINERS =====
// These containers are designed to test SSZ query functionality with comprehensive coverage
// of all fixed-size SSZ types according to the SSZ specification.
// FixedNestedContainer - nested container for testing nested field access
// Tests: nested container navigation, field offset calculations within nested structures
message FixedNestedContainer {
uint64 value1 = 1; // Test: uint64 basic type, offset calculation in nested context
bytes value2 = 2 [ (ethereum.eth.ext.ssz_size) = "32" ]; // Test: fixed-size bytes in nested container
}
// FixedTestContainer - comprehensive fixed-size container for SSZ query testing
// Tests: All basic fixed-size SSZ types, nested containers, vectors, offset/length calculations
// Total size: 365 bytes (4+4+4+8+1+8+16+32+40+192+56)
message FixedTestContainer {
// Basic integer types - test different integer sizes and their SSZ serialization
uint32 field_uint8 = 1; // Test: uint8 representation (4 bytes in protobuf/SSZ), offset: 0
uint32 field_uint16 = 2; // Test: uint16 representation (4 bytes in protobuf/SSZ), offset: 4
uint32 field_uint32 = 3; // Test: uint32 basic type, offset: 8
uint64 field_uint64 = 4; // Test: uint64 basic type, offset: 12
// Boolean type - test boolean serialization (1 byte in SSZ)
bool field_bool = 5; // Test: boolean basic type, offset: 20
// Fixed-size bytes - test various byte array lengths
bytes field_bytes8 = 6 [ (ethereum.eth.ext.ssz_size) = "8" ]; // Test: 8-byte array, offset: 21
bytes field_bytes16 = 7 [ (ethereum.eth.ext.ssz_size) = "16" ]; // Test: 16-byte array, offset: 29
bytes field_bytes32 = 8 [ (ethereum.eth.ext.ssz_size) = "32" ]; // Test: 32-byte array, offset: 45
// Nested container - test container nesting and field access
FixedNestedContainer nested = 9; // Test: nested container navigation, offset: 77
// Vector type - test fixed-size array of basic elements
repeated uint64 vector_field = 10 [ (ethereum.eth.ext.ssz_size) = "24" ]; // Test: Vector[24] of uint64, offset: 117
// Additional bytes field - test field ordering and offset calculation
bytes field_trailing = 11 [ (ethereum.eth.ext.ssz_size) = "56" ]; // Test: trailing field after vector, offset: 309
}
```
This [commit](https://github.com/OffchainLabs/prysm/pull/15588/commits/e001dfeedf56b28d5d46d0f1fdab9b9608b942ad) adds one `Container` called `FixedTestContainer`. This container looks huge, but the size is always fixed. This means the current implementation can be applied to any random path.
Based on this protobuf definition, Prysm provides a couple of hack scripts to generate `*.pb.go` file and `*.ssz.go`. (You can refer to [my past write-up](https://hackmd.io/em5tvy3tQTew4Qmj780W_Q#Background-How-are-pbgo-files-generated-And-How-does-sszgen-works)) Even though new `FixedTestContainer` looks simple enough to understand, there are lots of code for boilerplate (over 700 LOC). I asked Radek for his opinion of adding it like this way.