-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
x/bank: use internal package #4521
Conversation
Reorganise x/bank sub-packages and leverage internal special package for enhanced encapsulation.
71729c6
to
9e07d69
Compare
Codecov Report
@@ Coverage Diff @@
## master #4521 +/- ##
==========================================
- Coverage 53.49% 53.09% -0.41%
==========================================
Files 256 257 +1
Lines 16165 16285 +120
==========================================
- Hits 8648 8646 -2
- Misses 6870 6992 +122
Partials 647 647 |
x/bank/internal/handler/handler.go
Outdated
@@ -1,15 +1,16 @@ | |||
package bank | |||
package handler |
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.
hmm shouldn't this be under internal
?
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.
Nope, it needs to be handler. I could move it under types
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.
Nope, it's needs to be handler.
is it because a restriction from internal
that it can't live underx/bank/internal/handler.go
? I'm fine with it as long as we update #4438
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.
I'm unsure about using internal
just like other normal packages, i.e. dropping .go
files in internal
may not be permitted as internal may not compile.
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.
Hmmm, don't we want files like abci.go
and handler.go
to live in the parent/root of the module and not under internal
? I.e. I wouldn't like to see a module turn into everything being shoved into internal
with just an alias.go
at the root.
@@ -1,12 +1,12 @@ | |||
package bank | |||
package invariants |
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.
shouldn't this be under keeper
as other modules have it?
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.
I'm fine with that
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.
^^
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.
import cycles - I'd keep this as it is
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.
why? it shouldn't have any
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.
Possibly - will double check
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.
But I don't think that that is the reason - bank's internal types depend on each other
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.
The scope of this PR is not to introduce functional changes/refactoring. So please as long as it works just +1 :)
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.
I still think this should leave in keeper
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.
Is this possible @alessio? I don't mind helping out here!
a2976ca
to
8139158
Compare
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.
Mostly LGTM -- thanks @alessio. I don't think all the choices made here though are fully agreed upon. Namely, simulation messages and what should live under the root of the module. I don't want to see us starting to shove everything under internal/
.
x/bank/internal/handler/handler.go
Outdated
@@ -1,15 +1,16 @@ | |||
package bank | |||
package handler |
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.
Hmmm, don't we want files like abci.go
and handler.go
to live in the parent/root of the module and not under internal
? I.e. I wouldn't like to see a module turn into everything being shoved into internal
with just an alias.go
at the root.
Comments were addressed |
Co-Authored-By: Karoly Albert Szabo <[email protected]>
Closing this issue for now @alessio. Let's discuss further as most believe that this may not be the best approach after all. May potentially reopen after 👍 |
Reopening this |
|
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.
few structural changes required + clog
entry
@@ -1,12 +1,12 @@ | |||
package bank | |||
package invariants |
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.
I still think this should leave in keeper
x/bank/module.go
Outdated
@@ -90,7 +91,7 @@ func (AppModule) Name() string { | |||
|
|||
// register invariants | |||
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { | |||
RegisterInvariants(ir, am.accountKeeper) | |||
invariants.RegisterInvariants(ir, am.accountKeeper) |
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.
ditto
x/bank/msgs.go
Outdated
@@ -1,4 +1,4 @@ | |||
package simulation |
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.
this should remain in the simulation package
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.
Just a few minor nitpicks, but otherwise LGTM 👍
@@ -1,11 +1,13 @@ | |||
package bank | |||
package bank_test |
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.
Can we rename this file abci_test.go
and the corresponding file to abci.go
?
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.
this file contains a lot of mixed tests (some from keepers and others from msgs). I'd consider addressing this in a follow PR
x/bank/msgs.go
Outdated
@@ -1,4 +1,4 @@ | |||
package simulation | |||
package bank |
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.
Can we keep this structure as-is/unchanged (i.e. x/bank/simulation/*
)? I believe this is the pattern we want to follow in modules.
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.
I thought we said we wanted to keep only client
as top-level package?
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.
Simulation messages live top-level already, isn't that OK?
@@ -1,12 +1,12 @@ | |||
package bank | |||
package invariants |
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.
Is this possible @alessio? I don't mind helping out here!
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.
LGTM
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.
ACK
Reorganise x/bank packages and leverage internal special package for enhanced encapsulation.
Reorganise x/bank packages and leverage internal special
package for enhanced encapsulation.
docs/
)clog add [section] [stanza] [message]
Files changed
in the github PR explorerFor Admin Use: