Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(oracle): add query & cli for slashing window progress #1147

Merged
merged 7 commits into from
Jul 21, 2022

Conversation

adamewozniak
Copy link
Collaborator

Adds an oracle query for slashing window progress

closes: #1146


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • added appropriate labels to the PR
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@codecov-commenter
Copy link

codecov-commenter commented Jul 20, 2022

Codecov Report

Merging #1147 (a2afa02) into main (ef374ff) will decrease coverage by 0.16%.
The diff coverage is 22.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1147      +/-   ##
==========================================
- Coverage   43.82%   43.65%   -0.17%     
==========================================
  Files          65       65              
  Lines        8393     8460      +67     
==========================================
+ Hits         3678     3693      +15     
- Misses       4472     4523      +51     
- Partials      243      244       +1     
Impacted Files Coverage Δ
x/oracle/types/query.pb.gw.go 0.00% <0.00%> (ø)
x/oracle/keeper/grpc_query.go 98.01% <83.33%> (-1.99%) ⬇️

Comment on lines 151 to 157
slashWindow := params.SlashWindow
votePeriod := params.VotePeriod
currentBlock := ctx.BlockHeight()
votePeriodsPerSlashWindow := slashWindow / votePeriod

currentSlashWindow := uint64(currentBlock) / votePeriodsPerSlashWindow
blocksIntoSlashWindow := uint64(currentBlock) - (currentSlashWindow * slashWindow)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Taking suggestions on variable names here

Copy link
Contributor

Choose a reason for hiding this comment

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

out of ideas :/

@adamewozniak adamewozniak marked this pull request as ready for review July 21, 2022 14:34
@adamewozniak adamewozniak requested review from a team as code owners July 21, 2022 14:34
@mergify mergify bot merged commit 069e145 into main Jul 21, 2022
@mergify mergify bot deleted the woz/slash-window-query branch July 21, 2022 17:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Oracle query for slash window progress
3 participants