Files
prysm/encoding/ssz/query/container.go
Jun Song 5a897dfa6b SSZ-QL: Add endpoints (BeaconState/BeaconBlock) (#15888)
* Move ssz_query objects into testing folder (ensuring test objects only used in test environment)

* Add containers for response

* Export sszInfo

* Add QueryBeaconState/Block

* Add comments and few refactor

* Fix merge conflict issues

* Return 500 when calculate offset fails

* Add test for QueryBeaconState

* Add test for QueryBeaconBlock

* Changelog :)

* Rename `QuerySSZRequest` to `SSZQueryRequest`

* Fix middleware hooks for RPC to accept JSON from client and return SSZ

* Convert to `SSZObject` directly from proto

* Move marshalling/calculating hash tree root part after `CalculateOffsetAndLength`

* Make nogo happy

* Add informing comment for using proto unsafe conversion

---------

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
2025-10-20 16:24:06 +00:00

21 lines
633 B
Go

package query
// containerInfo has
// 1. fields: a field map that maps a field's JSON name to its SszInfo for nested Containers
// 2. order: a list of field names in the order they should be serialized
// 3. fixedOffset: the total size of the fixed part of the container
type containerInfo struct {
fields map[string]*fieldInfo
order []string
fixedOffset uint64
}
type fieldInfo struct {
// sszInfo contains the SSZ information of the field.
sszInfo *SszInfo
// offset is the offset of the field within the parent struct.
offset uint64
// goFieldName is the name of the field in Go struct.
goFieldName string
}