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

chore: set up IBCTestStakingKeeper interface #2028

Merged
merged 13 commits into from
Aug 23, 2022

Conversation

charleenfei
Copy link
Contributor

Description

closes: #1971


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • 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
  • Review Codecov Report in the comment section below once CI passes

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

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

LGTM, you'll need to update the GetStakingKeeper function in simapp/app.go as well. The readme needs to be updated too. Left a few comments

testing/types/expected_keepers.go Show resolved Hide resolved
testing/chain_test.go Outdated Show resolved Hide resolved
testing/types/expected_keepers.go Outdated Show resolved Hide resolved
@charleenfei charleenfei marked this pull request as ready for review August 18, 2022 14:40
@@ -48,7 +48,7 @@ type TestingApp interface {

// ibc-go additions
GetBaseApp() *baseapp.BaseApp
GetStakingKeeper() stakingkeeper.Keeper
GetIBCTestStakingKeeper() ibctestingtypes.StakingKeeper
Copy link
Contributor

Choose a reason for hiding this comment

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

I honestly liked the name GetStakingKeeper, since the name of the type already indicates that this is for testing, so I consider that is redundant to add Test in the name of the function... But no problem if we decide to rename it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i renamed on request from @ValarDragon in the issue, i don't have a particularly strong opinion either way tho. I can see the value add in being explicit, but it is true that the type is also quite informative.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think now that the interface returns the ibctestingtypes.StakingKeeper it can be redundant. I do agree GetStakingKeeper is cleaner, but I understand this function will be implemented in app.go for a production chain.

@ValarDragon do you still prefer GetIBCTestStakingKeeper given the new return value

Copy link
Contributor

@crodriguezvega crodriguezvega 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 picking this up, @charleenfei!

@@ -23,11 +23,11 @@ func TestChangeValSet(t *testing.T) {
amount2, ok := sdk.NewIntFromString("30000000000000000000")
require.True(t, ok)

val := chainA.App.GetStakingKeeper().GetValidators(chainA.GetContext(), 4)
val := chainA.GetSimApp().StakingKeeper.GetValidators(chainA.GetContext(), 4)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it not possible to keep using App.GetIBCTestStakingKeeper() and add GetValidators and Delegate to the StakingKeeper interface?

Copy link
Contributor Author

@charleenfei charleenfei Aug 19, 2022

Choose a reason for hiding this comment

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

i think the idea is that in our simApp, we would continue using the staking module's staking keeper so we don't actually need to add these two methods as they are already there.

it's just that in the testing chain and testing app setup, we would like to enable osmosis to swap out their customised interfluid staking keeper so they can use our testing setup. this is why we only need to add that one method which is used in the testing/chain.go file to the new interface.

Copy link
Contributor

Choose a reason for hiding this comment

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

I actually requested those functions to not be added. I think we should keep our interfaces as small as possible (ideally we wouldn't even need the staking keeper interface)

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

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

LGTM. Could you add a changelog entry?

I'm also okay leaving the GetStakingKeeper name as is and doing in a followup pr if it is still desired. I don't have strong preferences though

testing/simapp/app.go Show resolved Hide resolved
Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

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

followup ACK

testing/types/expected_keepers.go Outdated Show resolved Hide resolved
Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

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

Nice work!

@codecov-commenter
Copy link

Codecov Report

Merging #2028 (eea436e) into main (358ab8d) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2028   +/-   ##
=======================================
  Coverage   80.03%   80.03%           
=======================================
  Files         167      167           
  Lines       11784    11784           
=======================================
  Hits         9431     9431           
  Misses       1936     1936           
  Partials      417      417           
Impacted Files Coverage Δ
modules/apps/transfer/keeper/keeper.go 91.17% <ø> (ø)
modules/core/05-port/keeper/keeper.go 72.41% <100.00%> (ø)

@charleenfei charleenfei merged commit 4d4dbcf into main Aug 23, 2022
@charleenfei charleenfei deleted the charly/update_testing_stakingkeeper_interface branch August 23, 2022 07:54
mergify bot pushed a commit that referenced this pull request Aug 23, 2022
* initial interface definition

* update simapp

* update godocs

(cherry picked from commit 4d4dbcf)
@colin-axner
Copy link
Contributor

We should probably add a note about the API change in the migration docs. Maybe link the simapp change we have as well?

damiannolan added a commit that referenced this pull request Aug 24, 2022
* initial interface definition

* update simapp

* update godocs

(cherry picked from commit 4d4dbcf)

Co-authored-by: Charly <[email protected]>
Co-authored-by: Damian Nolan <[email protected]>
mergify bot pushed a commit that referenced this pull request Oct 6, 2022
* initial interface definition

* update simapp

* update godocs

(cherry picked from commit 4d4dbcf)

# Conflicts:
#	CHANGELOG.md
#	testing/app.go
#	testing/simapp/app.go
crodriguezvega pushed a commit that referenced this pull request Oct 8, 2022
* chore: set up IBCTestStakingKeeper interface  (#2028)

* initial interface definition

* update simapp

* update godocs

(cherry picked from commit 4d4dbcf)

# Conflicts:
#	CHANGELOG.md
#	testing/app.go
#	testing/simapp/app.go

* resolving conflicts

Co-authored-by: Charly <[email protected]>
Co-authored-by: Damian Nolan <[email protected]>
Co-authored-by: Carlos Rodriguez <[email protected]>
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.

Make IBCtesting GetStakingKeeper be based on an interface
6 participants