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: remove weird casting for staking.Keeper in slashing and distribution #12973

Merged
merged 5 commits into from
Aug 20, 2022

Conversation

robert-zaremba
Copy link
Collaborator

Description

Both slashing and distribution simulator is using ugly casting from the nice interface type to:

stakeKeeper := sk.(*stakingkeeper.Keeper)

This creates additional dependency for staking/keeper package in other modules, and requires type of a specific type (here reference type, in 0.46 it's even worse - because it uses object type).

EXTRA:

  • removed stakingkeepr.RandomValidator function (which btw, was also weird, because it was in the keeper module and required Keeper as an argument) and created generic testutil.RandSliceElem function.

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
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • 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 ! in the type prefix if API or client breaking change
  • 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)

Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

Thanks for the cleanup

Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

lgtm!

@julienrbrt julienrbrt added the A:automerge Automatically merge PR once all prerequisites pass. label Aug 20, 2022
@codecov
Copy link

codecov bot commented Aug 20, 2022

Codecov Report

Merging #12973 (b8a021f) into main (4fe7797) will decrease coverage by 0.29%.
The diff coverage is 62.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #12973      +/-   ##
==========================================
- Coverage   55.87%   55.58%   -0.30%     
==========================================
  Files         646      648       +2     
  Lines       54895    54925      +30     
==========================================
- Hits        30675    30532     -143     
- Misses      21762    21929     +167     
- Partials     2458     2464       +6     
Impacted Files Coverage Δ
baseapp/abci.go 64.09% <0.00%> (-0.33%) ⬇️
client/flags/flags.go 19.35% <0.00%> (-0.32%) ⬇️
client/rpc/status.go 66.66% <ø> (ø)
client/utils.go 34.92% <0.00%> (ø)
server/rosetta/client_online.go 1.35% <0.00%> (ø)
server/swagger.go 0.00% <0.00%> (ø)
simapp/app.go 82.66% <0.00%> (+3.55%) ⬆️
testutil/list.go 0.00% <0.00%> (ø)
types/result.go 76.74% <ø> (ø)
x/auth/tx/query.go 0.00% <ø> (ø)
... and 48 more

@julienrbrt julienrbrt added A:automerge Automatically merge PR once all prerequisites pass. and removed A:automerge Automatically merge PR once all prerequisites pass. labels Aug 20, 2022
@mergify mergify bot merged commit 7cb85c5 into main Aug 20, 2022
@mergify mergify bot deleted the robert/sim-staking branch August 20, 2022 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:Simulations C:x/distribution distribution module related C:x/slashing C:x/staking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants