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

R4R: Emit Warning Events when Validator Misses Blocks #4629

Merged
merged 12 commits into from
Jun 28, 2019

Conversation

AdityaSripal
Copy link
Member

@AdityaSripal AdityaSripal commented Jun 26, 2019

Emits warning events if a validator misses a certain number of blocks DowntimeWarning. Continues to emit warning events for any additional DowntimeWarning blocks that validator misses during SigningBlockWindow

  • 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: clog 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)

@codecov
Copy link

codecov bot commented Jun 26, 2019

Codecov Report

Merging #4629 into master will increase coverage by 0.03%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #4629      +/-   ##
==========================================
+ Coverage   54.11%   54.14%   +0.03%     
==========================================
  Files         260      260              
  Lines       16371    16379       +8     
==========================================
+ Hits         8859     8869      +10     
+ Misses       6866     6864       -2     
  Partials      646      646

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.

I really like the goal of this PR, although I'm not convinced a parameter is the right way to go here. Could it be set on the configuration instead ? Maybe some validators will want to have their custom block period for the warning.

Thoughts ? @alessio @sabau

@@ -0,0 +1,2 @@
Added warning event that gets emitted if validator misses certain number of blocks, and re-emits periodically.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Added warning event that gets emitted if validator misses certain number of blocks, and re-emits periodically.
#4629 Added warning event that gets emitted if validator misses certain number of blocks, and re-emits periodically.

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

mhmmm, so this is slightly different than what we talked about out of band. We're adding a new parameter here which is state machine breaking.

I was under the impression we'd always emit an event whenever a validator misses a block (which is pretty low from my inspection) which makes the changes really simple and has no need for a new param:

ctx.EventManager().EmitEvent(
    sdk.NewEvent(
	types.EventTypeLiveness,
	sdk.NewAttribute(types.AttributeKeyAddress, consAddr.String()),
	sdk.NewAttribute(types.AttributeKeyPower, fmt.Sprintf("%d", power)),
	sdk.NewAttribute(types.AttributeKeyHeight, fmt.Sprintf("%d", height)),
    ),
)

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.

The implementation per se looks fine - I question the rationale behind the decision to make this a parameter. In my view, this should be a configuration option

@alexanderbez
Copy link
Contributor

It shouldn't be any option at all...just simply emitted.

@alessio
Copy link
Contributor

alessio commented Jun 27, 2019 via email

@AdityaSripal
Copy link
Member Author

@alexanderbez, yea I thought it might make sense to have the warning events be tunable. Even if Gaia currently doesn't have an issue with missed blocks; other chains or Gaia in the future might have too many missed blocks for an event for every missed_block for each validator to be feasible.

I agree that it shouldn't be an application-level parameter tho. @fedekunze's suggestion to make this a config option seems right to me. The only potential weirdness i see is that different validators would fire events at different times because they are unilaterally setting this parameter in config. I don't think this is a huge deal tho.

@AdityaSripal AdityaSripal changed the title Emit Warning Events when Validator Misses Blocks R4R: Emit Warning Events when Validator Misses Blocks Jun 27, 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.

ACKed

docs/spec/slashing/04_begin_block.md Outdated Show resolved Hide resolved
docs/spec/slashing/04_begin_block.md Outdated Show resolved Hide resolved
x/slashing/keeper.go Outdated Show resolved Hide resolved
x/slashing/keeper.go Show resolved Hide resolved
x/slashing/keeper.go Outdated Show resolved Hide resolved
docs/spec/slashing/06_events.md Outdated Show resolved Hide resolved
docs/spec/slashing/06_events.md Outdated Show resolved Hide resolved
x/slashing/keeper.go Outdated Show resolved Hide resolved
Copy link
Contributor

@alexanderbez alexanderbez 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 f9dea98 into master Jun 28, 2019
@alexanderbez alexanderbez deleted the aditya/warn_event branch June 28, 2019 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants