Conversation
|
Hmm I wonder if another flakey test? Ran the tests locally before opening PR and was fine. Also these failures look unrelated to the changes being added @tzdybal |
tzdybal
left a comment
There was a problem hiding this comment.
The tests are failing consistently locally. I left comments.
| commit := new(types.Commit) | ||
| err = commit.UnmarshalBinary(commitData) | ||
| return commit, err | ||
| return commit, fmt.Errorf("error decoding binary data of Commit into object: %w", err) |
There was a problem hiding this comment.
Gotcha! In original case, if error was nil, nil was returned. Now, you're wrapping everytime, even if error is nil.
| return commit, fmt.Errorf("error decoding binary data of Commit into object: %w", err) | |
| if err != nil { | |
| return nil, fmt.Errorf("error decoding binary data of Commit into object: %w", err) | |
| } | |
| return commit, nil |
| err = json.Unmarshal(blob, &state) | ||
| atomic.StoreUint64(&s.height, uint64(state.LastBlockHeight)) | ||
| return state, err | ||
| return state, fmt.Errorf("error unmarshalling state from JSON encoding: %w", err) |
Thank you! I realized I was running the test locally on |
Codecov Report
@@ Coverage Diff @@
## main #404 +/- ##
==========================================
- Coverage 56.54% 56.47% -0.07%
==========================================
Files 44 44
Lines 7518 7527 +9
==========================================
Hits 4251 4251
- Misses 2659 2665 +6
- Partials 608 611 +3
Continue to review full report at Codecov.
|
tzdybal
left a comment
There was a problem hiding this comment.
Comments seems a bit incoherent (for example error encoding Block into binary form and error marshalling state into JSON encoding) - please stick to single form.
| {"valid/no params", "/abci_info", http.StatusOK, -1, `"last_block_height":345`}, | ||
| // to keep test simple, allow returning application error in following case | ||
| {"valid/int param", "/block?height=321", http.StatusOK, int(json2.E_INTERNAL), `"key not found"`}, | ||
| {"valid/int param", "/block?height=321", http.StatusOK, int(json2.E_INTERNAL), "error loading hash by height 321: key not found"}, |
There was a problem hiding this comment.
I think that it might not be "stable" to include block number here.
| {"valid/int param", "/block?height=321", http.StatusOK, int(json2.E_INTERNAL), "error loading hash by height 321: key not found"}, | |
| {"valid/int param", "/block?height=321", http.StatusOK, int(json2.E_INTERNAL), "error loading block hash for height"}, |
| var hash [32]byte | ||
| if err != nil { | ||
| return hash, err | ||
| return hash, fmt.Errorf("error loading hash by height %v: %w", height, err) |
There was a problem hiding this comment.
| return hash, fmt.Errorf("error loading hash by height %v: %w", height, err) | |
| return hash, fmt.Errorf("error loading block hash for height %v: %w", height, err) |
There was a problem hiding this comment.
Hey @tzdybal sorry I am a little unsure as to what you mean by the singular form in this case
tzdybal
left a comment
There was a problem hiding this comment.
Now it looks way better :)
| blob, err := s.db.Get(getStateKey()) | ||
| if err != nil { | ||
| return types.State{}, err | ||
| return types.State{}, fmt.Errorf("failed to retrieve key: %w", err) |
There was a problem hiding this comment.
| return types.State{}, fmt.Errorf("failed to retrieve key: %w", err) | |
| return types.State{}, fmt.Errorf("failed to retrieve state: %w", err) |
| {"valid/no params", "/abci_info", http.StatusOK, -1, `"last_block_height":"345"`}, | ||
| // to keep test simple, allow returning application error in following case | ||
| {"valid/int param", "/block?height=321", http.StatusOK, int(json2.E_INTERNAL), `"key not found"`}, | ||
| {"valid/int param", "/block?height=321", http.StatusOK, int(json2.E_INTERNAL), "error loading block hash for height"}, |
Wraps errors returned from the Store