-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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(bank): migrate to use env var #19477
Changes from 5 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,7 +131,7 @@ func (suite *KeeperTestSuite) SetupTest() { | |
ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Time: time.Now()}) | ||
encCfg := moduletestutil.MakeTestEncodingConfig() | ||
|
||
storeService := runtime.NewKVStoreService(key) | ||
env := runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()) | ||
|
||
// gomock initializations | ||
ctrl := gomock.NewController(suite.T()) | ||
Comment on lines
131
to
137
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The repeated creation of // Suggestion to reduce duplication by creating a helper function.
func newTestEnvironment(key storetypes.StoreKey) runtime.Environment {
return runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger())
} Then replace the direct calls with Also applies to: 303-306 |
||
|
@@ -140,8 +140,8 @@ func (suite *KeeperTestSuite) SetupTest() { | |
suite.ctx = ctx | ||
suite.authKeeper = authKeeper | ||
suite.bankKeeper = keeper.NewBaseKeeper( | ||
env, | ||
encCfg.Codec, | ||
storeService, | ||
suite.authKeeper, | ||
map[string]bool{accAddrs[4].String(): true}, | ||
authtypes.NewModuleAddress(banktypes.GovModuleName).String(), | ||
|
@@ -300,11 +300,11 @@ func (suite *KeeperTestSuite) TestPrependSendRestriction() { | |
} | ||
|
||
func (suite *KeeperTestSuite) TestGetAuthority() { | ||
storeService := runtime.NewKVStoreService(storetypes.NewKVStoreKey(banktypes.StoreKey)) | ||
env := runtime.NewEnvironment(runtime.NewKVStoreService(storetypes.NewKVStoreKey(banktypes.StoreKey)), log.NewNopLogger()) | ||
NewKeeperWithAuthority := func(authority string) keeper.BaseKeeper { | ||
return keeper.NewBaseKeeper( | ||
env, | ||
moduletestutil.MakeTestEncodingConfig().Codec, | ||
storeService, | ||
suite.authKeeper, | ||
nil, | ||
authority, | ||
|
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 comment regarding the potential return of an error from
TrackDelegation
suggests a future improvement. It's important to track this as a TODO or open an issue to ensure it's addressed, as error handling is crucial for robustness and reliability.Would you like me to open a GitHub issue to track the enhancement of error handling in
TrackDelegation
andTrackUndelegation
?