mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-07 22:54:17 -05:00
* added tests for calculating generalized indices * added first version of GI calculation walking the specified path with no recursion. Extended test coverage for bitlist and bitvectors. vectors need more testing * refactored code. Detached PathElement processing, currently done at the beginning. Swap to regex to gain flexibility. * added an updateRoot function with the GI formula. more refactoring * added changelog * replaced TODO tag * udpated some comments * simplified code - removed duplicated code in processingLengthField function * run gazelle * merging all input path processing into path.go * reviewed Jun's feedback * removed unnecessary idx pointer var + fixed error with length data type (uint64 instead of uint8) * refactored path.go after merging path elements from generalized_indices.go * re-computed GIs for tests as VariableTestContainer added a new field. * added minor comment - rawPath MUST be snake case removed extractFieldName func. * fixed vector GI calculation - updated tests GIs * removed updateRoot function in favor of inline code * path input data enforced to be snake case * added sanity checks for accessing outbound element indices - checked against vector.length/list.limit * fixed issues triggered after merging develop * Removed redundant comment Co-authored-by: Jun Song <87601811+syjn99@users.noreply.github.com> * removed unreachable condition as `strings.Split` always return a slice with length >= 1 If s does not contain sep and sep is not empty, Split returns a slice of length 1 whose only element is s. * added tests to cover edge cases + cleaned code (toLower is no longer needed in extractFieldName function * added Jun's feedback + more testing * postponed snake case conversion to do it on a per-element-basis. Added more testing focused mainly in snake case conversion * addressed several Jun's comments. * added sanity check to prevent length of a multi-dimensional array. added more tests with extended paths * Update encoding/ssz/query/generalized_index.go Co-authored-by: Radosław Kapka <radoslaw.kapka@gmail.com> * Update encoding/ssz/query/generalized_index.go Co-authored-by: Radosław Kapka <radoslaw.kapka@gmail.com> * Update encoding/ssz/query/generalized_index.go Co-authored-by: Radosław Kapka <radoslaw.kapka@gmail.com> * placed constant bitsPerChunk in the right place. Exported BitsPerChunk and BytesPerChunk and updated code that use them * added helpers for computing GI of each data type * changed %q in favor of %s * Update encoding/ssz/query/path.go Co-authored-by: Jun Song <87601811+syjn99@users.noreply.github.com> * removed the least restrictive condition isBasicType * replaced length of containerInfo.order for containerInfo.fields for clarity * removed outdated comment * removed toSnakeCase conversion. * moved isBasicType func to its natural place, SSZType * cosmetic refactor - renamed itemLengthFromInfo to itemLength (same name is in spec). - arranged all SSZ helpers. * cleaned tests * renamed "root" to "index" * removed unnecessary check for negative integers. Replaced %q for %s. * refactored regex variables and prevented re-assignation * added length regex explanation * added more testing for stressing regex for path processing * renamed currentIndex to parentIndex for clarity and documented the returns from calculate<Type>GeneralizedIndex functions * Update encoding/ssz/query/generalized_index.go Co-authored-by: Radosław Kapka <radoslaw.kapka@gmail.com> * run gazelle * fixed never asserted error. Updated error message --------- Co-authored-by: Jun Song <87601811+syjn99@users.noreply.github.com> Co-authored-by: Radosław Kapka <radoslaw.kapka@gmail.com> Co-authored-by: Radosław Kapka <rkapka@wp.pl>