mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 07:58:22 -05:00
* Add vectorInfo * Add 2D bytes field for test * Add tag_parser for parsing SSZ tags * Integrate tag parser with analyzer * Add ByteList test case * Changelog * Better printing feature with Stringer implementation * Return error for non-determined case without printing other values * Update tag_parser.go: handle Vector and List mutually exclusive (inspired by OffchainLabs/fastssz) * Make linter happy --------- Co-authored-by: Radosław Kapka <rkapka@wp.pl>
28 lines
484 B
Go
28 lines
484 B
Go
package query
|
|
|
|
import "errors"
|
|
|
|
// vectorInfo holds information about a SSZ Vector type.
|
|
type vectorInfo struct {
|
|
// element is the SSZ info of the vector's element type.
|
|
element *sszInfo
|
|
// length is the fixed length of the vector.
|
|
length uint64
|
|
}
|
|
|
|
func (v *vectorInfo) Length() uint64 {
|
|
if v == nil {
|
|
return 0
|
|
}
|
|
|
|
return v.length
|
|
}
|
|
|
|
func (v *vectorInfo) Element() (*sszInfo, error) {
|
|
if v == nil {
|
|
return nil, errors.New("vectorInfo is nil")
|
|
}
|
|
|
|
return v.element, nil
|
|
}
|