mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 13:28:01 -05:00
SSZ-QL: populate variable-length metadata in AnalyzeObject (#15676)
* increased AnalyzeObject functionality to return a fully populated SSZInfo object including runtime lengths for lists * reverted formatting change --------- Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
### Added
|
||||
|
||||
- Populate sszInfo of variable-length fields in AnalyzeObjects
|
||||
@@ -18,6 +18,12 @@ func AnalyzeObject(obj any) (*sszInfo, error) {
|
||||
return nil, fmt.Errorf("could not analyze type %s: %w", value.Type().Name(), err)
|
||||
}
|
||||
|
||||
// Populate variable-length information using the actual value.
|
||||
err = PopulateVariableLengthInfo(info, value.Interface())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not populate variable length info: %w", err)
|
||||
}
|
||||
|
||||
return info, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -171,11 +171,9 @@ func TestCalculateOffsetAndLength(t *testing.T) {
|
||||
path, err := query.ParsePath(tt.path)
|
||||
require.NoError(t, err)
|
||||
|
||||
info, err := query.AnalyzeObject(&sszquerypb.VariableTestContainer{})
|
||||
require.NoError(t, err)
|
||||
|
||||
testContainer := createVariableTestContainer()
|
||||
err = query.PopulateVariableLengthInfo(info, testContainer)
|
||||
|
||||
info, err := query.AnalyzeObject(testContainer)
|
||||
require.NoError(t, err)
|
||||
|
||||
_, offset, length, err := query.CalculateOffsetAndLength(info, path)
|
||||
|
||||
Reference in New Issue
Block a user