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

07-tendermint: ignore misbehaviour if age is greater than consensus params #6422

Merged
merged 14 commits into from
Jun 18, 2020

Conversation

fedekunze
Copy link
Collaborator

@fedekunze fedekunze commented Jun 12, 2020

Description

closes: #6316

Also bumped coverage to cover all misbehaviour cases


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • 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.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

// - ValidatorSet must have 2/3 similarity with trusted FromValidatorSet
// - ValidatorSets on both headers are valid given the last trusted ValidatorSet
if err := consensusState.ValidatorSet.VerifyCommitTrusting(
evidence.ChainID, evidence.Header1.Commit.BlockID, evidence.Header1.Height,
evidence.Header1.Commit, lite.DefaultTrustLevel,
evidence.Header1.Commit, clientState.TrustLevel,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

looks like we were still using the default for misbehavior 👀

@codecov
Copy link

codecov bot commented Jun 12, 2020

Codecov Report

Merging #6422 into master will increase coverage by 0.08%.
The diff coverage is 73.91%.

@@            Coverage Diff             @@
##           master    #6422      +/-   ##
==========================================
+ Coverage   56.06%   56.14%   +0.08%     
==========================================
  Files         466      466              
  Lines       27904    27921      +17     
==========================================
+ Hits        15643    15675      +32     
+ Misses      11149    11140       -9     
+ Partials     1112     1106       -6     

x/ibc/07-tendermint/types/evidence.go Outdated Show resolved Hide resolved
x/ibc/07-tendermint/misbehaviour.go Show resolved Hide resolved
x/ibc/07-tendermint/misbehaviour_test.go Outdated Show resolved Hide resolved
x/ibc/02-client/handler.go Outdated Show resolved Hide resolved
ageDuration, ageBlocks, consensusParams.Evidence.MaxAgeDuration, consensusParams.Evidence.MaxAgeNumBlocks,
)
}

// check if provided height matches the headers' height
if height > uint64(evidence.GetHeight()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't quite understand what this is checking? If we want to make sure that the evidence isn't at a height in the future shouldn't we check the opposite i.e that if height < evidence.GetHeight()

Copy link
Contributor

Choose a reason for hiding this comment

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

No, this height is the height from which we retrieve the old header to test from, so it must be before the two conflicting headers.

cwgoes
cwgoes previously requested changes Jun 17, 2020
Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

I believe GetTime() needs to change.

x/ibc/07-tendermint/types/evidence.go Outdated Show resolved Hide resolved
@fedekunze fedekunze requested a review from cwgoes June 17, 2020 18:57
Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

I don't think this quite matches Tendermint still, see https://github.com/tendermint/tendermint/blob/95d2d136cdcff2a3bb29d4e4271d757e4f88867c/types/evidence.go#L289 - I don't understand why Tendermint does it this way, though.

@tac0turtle
Copy link
Member

I don't think this quite matches Tendermint still, see tendermint/tendermint:types/evidence.go@95d2d13#L289 - I don't understand why Tendermint does it this way, though.

@anton or @cmwaters do you know why we sort votes lexicographically based on BlockID?

@cwgoes
Copy link
Contributor

cwgoes commented Jun 18, 2020

I don't think this quite matches Tendermint still, see tendermint/tendermint:types/evidence.go@95d2d13#L289 - I don't understand why Tendermint does it this way, though.

@anton or @cmwaters do you know why we sort votes lexicographically based on BlockID?

As far as I can reason (so far) this is just arbitrary & should be fixed in Tendermint - tendermint/tendermint#5030.

@fedekunze fedekunze dismissed cwgoes’s stale review June 18, 2020 16:52

Per discussion, I will add an issue to track the tendermint fix and merge it as is

@fedekunze fedekunze merged commit fe9356d into master Jun 18, 2020
@fedekunze fedekunze deleted the fedekunze/6316-evidence-height branch June 18, 2020 16:52
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.

Switch Tendermint client evidence/misbehaviour logic to use both height & time
7 participants