-
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
refactor!: use KVStoreService and context.Context in x/bank #15891
Conversation
@@ -12,7 +14,7 @@ import ( | |||
// | |||
// TODO: Instead of using the mint module account, which has the | |||
// permission of minting, create a "faucet" account. (@fdymylja) | |||
func FundAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error { | |||
func FundAccount(ctx context.Context, bankKeeper bankkeeper.Keeper, addr sdk.AccAddress, amounts sdk.Coins) error { |
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.
changelog for this as well, it might be used by others
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 changelog entry is still missing.
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 misread, now I've added:
`NewKeeper` now takes a `KVStoreService` instead of a `StoreKey` and methods in the `Keeper` now take a `context.Context` instead of a `sdk.Context`. Also `FundAccount` and `FundModuleAccount` from the `testutil` package accept a `context.Context` instead of a `sdk.Context`, and it's position was moved to the first place.
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.
left a few comments for changelogs otherwise looks good, nice job
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! one tiny nit.
x/bank/keeper/send.go
Outdated
@@ -134,7 +135,8 @@ func (k BaseSendKeeper) InputOutputCoins(ctx sdk.Context, input types.Input, out | |||
return err | |||
} | |||
|
|||
ctx.EventManager().EmitEvent( | |||
c := sdk.UnwrapSDKContext(ctx) |
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.
nit, sdkCtx is usually how we call 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.
whoops, ty
x/bank/keeper/send.go
Outdated
@@ -249,7 +252,8 @@ func (k BaseSendKeeper) subUnlockedCoins(ctx sdk.Context, addr sdk.AccAddress, a | |||
} | |||
} | |||
|
|||
ctx.EventManager().EmitEvent( | |||
c := sdk.UnwrapSDKContext(ctx) |
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
Description
We are still using
runtime.KVStoreAdapter
in cases we useprefix.Store
.Also because there were a couple of functions that had the context as the 2nd argument, now that it's a context.Context the linter picked it up as an error, so there are a lot of changes like this:
Ref: #14683
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...
!
to the type prefix if API or client breaking changeCHANGELOG.md
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...
!
in the type prefix if API or client breaking change