Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return correct error on invalid messages #4100

Merged
merged 5 commits into from
Apr 15, 2019

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Apr 11, 2019

closes: #3978


  • Targeted PR against correct branch (see CONTRIBUTING.md)

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.

  • Wrote tests

  • Updated relevant documentation (docs/)

  • Added a relevant changelog entry: sdkch add [section] [stanza] [message]

  • rereviewed Files changed in the github PR explorer


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@alexanderbez alexanderbez added WIP T: API Breaking Breaking changes that impact APIs and the SDK only (not state machine). Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity. labels Apr 11, 2019
@alexanderbez alexanderbez changed the title Implement a new invalid message type Return InvalidMsg on invalid messages Apr 11, 2019
@codecov
Copy link

codecov bot commented Apr 11, 2019

Codecov Report

Merging #4100 into develop will increase coverage by 0.12%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           develop   #4100      +/-   ##
==========================================
+ Coverage    59.97%   60.1%   +0.12%     
==========================================
  Files          211     211              
  Lines        15111   15114       +3     
==========================================
+ Hits          9063    9084      +21     
+ Misses        5428    5410      -18     
  Partials       620     620

@alexanderbez alexanderbez marked this pull request as ready for review April 15, 2019 13:04
@alexanderbez alexanderbez changed the title Return InvalidMsg on invalid messages Return correct error on invalid messages Apr 15, 2019
Copy link
Contributor

@alessio alessio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean and straightforward. I've requested writing a simple test case

x/slashing/handler.go Show resolved Hide resolved
x/staking/handler.go Show resolved Hide resolved
@alexanderbez
Copy link
Contributor Author

Added test cases for this exact path @alessio

@alexanderbez alexanderbez requested a review from sabau April 15, 2019 14:00
"github.com/stretchr/testify/require"
)

func TestInvalidMsg(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, we didn't have any test for the handler ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly, no. I believe most of the handler testing is done through simulation and app/abci module tests, but not directly.

Copy link
Contributor

@alessio alessio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@alexanderbez alexanderbez merged commit 585b68e into develop Apr 15, 2019
@alexanderbez alexanderbez deleted the bez/3978-invalid-msg-error branch April 15, 2019 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: API Breaking Breaking changes that impact APIs and the SDK only (not state machine). Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

module handler decode error
3 participants