Replace byte arrays with hex encoding for json#552
Merged
GalRogozinski merged 25 commits intomainfrom Jul 17, 2025
Merged
Conversation
ssv/spectest/tests/valcheck/valcheckduty/far_future_duty_slot.go
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Good job!
I think it looks better now and has less confusing boilerplate code
Some comments I couldn't put in place due to VSCode bugs:
- hash changes in beacon types encoding and messages encoding (under investigation)
- In json_testutils consider the DRY (don't repeat yourself) approach that helps with future maintainability.
You could add the following helper functions, and then later only edit them as neccessary:
// hexStringFromJSON trims surrounding quotes from a JSON string value.
func hexStringFromJSON(data []byte) string {
return strings.TrimSuffix(strings.TrimPrefix(string(data), "\""), "\"")
}
// tryUnmarshalByteArray tries to unmarshal a JSON array of bytes of a given length.
func tryUnmarshalByteArray(data []byte, expectedLen int) ([]byte, error) {
var arr []byte
if err := json.Unmarshal(data, &arr); err == nil {
if len(arr) != expectedLen {
return nil, fmt.Errorf("invalid array length: expected %d, got %d", expectedLen, len(arr))
}
return arr, nil
}
return nil, fmt.Errorf("not a valid byte array")
}- I spotted
DataRound:0changed toRound:1... we have leftovers form other PRs?
Maybe it will get better after you fix conflicts
MatheusFranco99
previously approved these changes
Jul 9, 2025
Contributor
MatheusFranco99
left a comment
There was a problem hiding this comment.
Looks good to me! Good job!
GalRogozinski
previously approved these changes
Jul 13, 2025
MatheusFranco99
previously approved these changes
Jul 14, 2025
Contributor
|
Lgtm thanks |
Contributor
|
Follow up: this should also be applied to the entire repository, not just qbft |
0a36059
GalRogozinski
approved these changes
Jul 17, 2025
Contributor
|
@Zacholme7 |
dknopik
approved these changes
Jul 17, 2025
Collaborator
dknopik
left a comment
There was a problem hiding this comment.
Approving based on Zac's LGTM above
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #278
This PR creates custom marshallers and unmarshallers to change the encoding of bytes arrays in test json files to hex encoded strings