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

Migrate Equivocation Handling to x/evidence #5299

Merged
merged 36 commits into from
Dec 3, 2019

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Nov 8, 2019

  • Move HandleDoubleSign from x/slashing to the x/evidence module
  • Move double sign params from x/slashing to the x/evidence module
  • Cleanup specs
  • Add params handler to x/evidence client logic

closes: #5296


  • 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 to the Unreleased section in CHANGELOG.md

  • Re-reviewed 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)

@codecov
Copy link

codecov bot commented Nov 28, 2019

Codecov Report

Merging #5299 into master will decrease coverage by <.01%.
The diff coverage is 67.9%.

@@            Coverage Diff             @@
##           master    #5299      +/-   ##
==========================================
- Coverage   54.79%   54.79%   -0.01%     
==========================================
  Files         307      311       +4     
  Lines       18296    18386      +90     
==========================================
+ Hits        10026    10075      +49     
- Misses       7494     7540      +46     
+ Partials      776      771       -5

@alexanderbez alexanderbez marked this pull request as ready for review November 28, 2019 20:57
@alexanderbez alexanderbez added R4R and removed WIP labels Nov 28, 2019
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.

Thanks @alexanderbez for doing this refactor. The distinctions between modules are much clearer now 👏

I left some questions but otherwise LGTM

}

// reject evidence if the double-sign is too old
if age > k.MaxEvidenceAge(ctx) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

q: shouldn't every evidence type define its own evidence age instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so because all evidence must be within the unbonding period. Perhaps certain evidence can have even smaller valid periods (e.g. 1/2 unbonding period), but I don't see any immediate use-cases or evidence types that need this.

x/evidence/internal/keeper/params.go Show resolved Hide resolved
x/evidence/internal/types/evidence.go Show resolved Hide resolved
x/slashing/internal/keeper/signing_info.go Outdated Show resolved Hide resolved
x/slashing/internal/keeper/signing_info.go Show resolved Hide resolved
x/evidence/module.go Show resolved Hide resolved
x/evidence/abci.go Show resolved Hide resolved
Copy link
Member

@AdityaSripal AdityaSripal left a comment

Choose a reason for hiding this comment

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

Great work! Small nitpicks

Only important question is why DoubleSignJailTime is treated as a constant rather than as a parameter

x/evidence/internal/types/evidence.go Outdated Show resolved Hide resolved
x/evidence/client/rest/query.go Outdated Show resolved Hide resolved
x/evidence/internal/types/params.go Show resolved Hide resolved
@AdityaSripal
Copy link
Member

Also a heads-up, the Evidence interface got changed in #5321 to accomodate chain misbehaviour. Might require some changes to this PR but nothing substantial.

Would just require asserting that the Equivocation struct satified ValidatorEvidence interface rather than looser Evidence interface

@alexanderbez
Copy link
Contributor Author

@AdityaSripal @fedekunze I've updated and addressed all comments.


Also a heads-up, the Evidence interface got changed in #5321 to accomodate chain misbehaviour. Might require some changes to this PR but nothing substantial.

Would just require asserting that the Equivocation struct satified ValidatorEvidence interface rather than looser Evidence interface

How so? What if we merge this PR first? I haven't looked at the PR yet, but I imagine the stricter interface contract is warranted?

@AdityaSripal
Copy link
Member

AdityaSripal commented Dec 3, 2019

The new ValidatorEvidence interface is identical to the current Evidence interface.

The original Evidence interface was made looser in #5321 to accommodate other forms of Evidence that are not Validator-specific; namely entire chains misbehaving

We can merge this PR first, would require a trivial change to fix things once my PR is merged so i can do that.

@alexanderbez
Copy link
Contributor Author

Great! Sounds like a plan. Thanks for the review <3

@alexanderbez alexanderbez merged commit 7953b52 into master Dec 3, 2019
@alexanderbez alexanderbez deleted the bez/5296-evidence-slashing branch December 3, 2019 01:58
xiangjianmeng pushed a commit to xiangjianmeng/cosmos-sdk that referenced this pull request Dec 18, 2019
Codegnosis added a commit to unification-com/mainchain that referenced this pull request Jan 27, 2020
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slashing and Evidence Module Relationship
3 participants