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

Refactor Evidence Age Util + Governable Consensus Params #5952

Merged
merged 36 commits into from
Apr 16, 2020

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Apr 7, 2020

Description

  • Remove usage and dependency of the main store key.
    • Load(Latest)Version no longer requires a store key parameter.
  • Add ParamStore to the BaseApp. The ParamStore is a simple interface that the x/params module subspace type implements. This will allow consensus parameters to be modified via governance.
  • Add checkType call to Subspace#GetIfExists.
  • Remove x/evidence params

The only potentially contentious change here is the change to BaseApp and its use of the param store provided by x/params. Note, however, BaseApp does not rely on that package.

TODO:

  • Update any necessary baseapp docs
  • Test on a localnet
  • Handle state export?

closes: #5532


For contributor use:

  • 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

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

simapp/app.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Apr 13, 2020

Codecov Report

Merging #5952 into master will increase coverage by 0.00%.
The diff coverage is 57.28%.

@@           Coverage Diff           @@
##           master    #5952   +/-   ##
=======================================
  Coverage   58.27%   58.28%           
=======================================
  Files         396      397    +1     
  Lines       23595    23646   +51     
=======================================
+ Hits        13750    13782   +32     
- Misses       8883     8902   +19     
  Partials      962      962           

Comment on lines 42 to 64
// calculate the age of the evidence
infractionHeight := evidence.GetHeight()
infractionTime := evidence.GetTime()
ageDuration := ctx.BlockHeader().Time.Sub(infractionTime)
ageBlocks := ctx.BlockHeader().Height - infractionHeight

// Reject evidence if the double-sign is too old. Evidence is considered stale
// if the differenc in time and number of blocks is greater than the allowed
// parameters defined.
cp := ctx.ConsensusParams()
if cp != nil && cp.Evidence != nil {
if ageDuration > cp.Evidence.MaxAgeDuration && ageBlocks > cp.Evidence.MaxAgeNumBlocks {
logger.Info(
"ignored equivocation; evidence too old",
"validator", consAddr,
"infraction_height", infractionHeight,
"max_age_num_blocks", cp.Evidence.MaxAgeNumBlocks,
"infraction_time", infractionTime,
"max_age_duration", cp.Evidence.MaxAgeDuration,
)
return
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the core change with regard to the initial intent of the PR.

/cc @cwgoes @ebuchman @melekes

@alexanderbez alexanderbez added T: State Machine Breaking State machine breaking changes (impacts consensus). C:x/params labels Apr 13, 2020
@alexanderbez alexanderbez marked this pull request as ready for review April 13, 2020 20:55
fedekunze and others added 3 commits April 13, 2020 20:00
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
simapp/app.go Outdated Show resolved Hide resolved
std/doc.go Outdated Show resolved Hide resolved
std/doc.go Outdated Show resolved Hide resolved
alexanderbez and others added 4 commits April 15, 2020 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:baseapp C:x/evidence C:x/params T: State Machine Breaking State machine breaking changes (impacts consensus).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evidence Age & Tendermint
6 participants