-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alexanderbez
commented
Apr 8, 2020
Codecov Report
@@ 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 |
alexanderbez
commented
Apr 13, 2020
x/evidence/keeper/infraction.go
Outdated
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 | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alexanderbez
added
T: State Machine Breaking
State machine breaking changes (impacts consensus).
C:x/params
labels
Apr 13, 2020
alexanderbez
requested review from
alessio,
fedekunze and
hschoenburg
as code owners
April 13, 2020 20:55
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
melekes
approved these changes
Apr 14, 2020
jgimeno
approved these changes
Apr 14, 2020
aaronc
reviewed
Apr 14, 2020
…smos-sdk into bez/5532-evidence-age-refactor
aaronc
reviewed
Apr 15, 2020
aaronc
approved these changes
Apr 15, 2020
aaronc
reviewed
Apr 15, 2020
Co-Authored-By: Aaron Craelius <aaron@regen.network>
Co-Authored-By: Aaron Craelius <aaron@regen.network>
4 tasks
4 tasks
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
Labels
C:baseapp
C:x/evidence
C:x/params
T: State Machine Breaking
State machine breaking changes (impacts consensus).
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
main
store key.Load(Latest)Version
no longer requires a store key parameter.ParamStore
to theBaseApp
. TheParamStore
is a simple interface that thex/params
module subspace type implements. This will allow consensus parameters to be modified via governance.checkType
call toSubspace#GetIfExists
.x/evidence
paramsThe 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:
closes: #5532
For contributor use:
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerFor admin use:
WIP
,R4R
,docs
, etc)