-
Notifications
You must be signed in to change notification settings - Fork 27
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
Use KVStoreService instead of StoreKey #1028
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1028 +/- ##
==========================================
- Coverage 61.29% 60.50% -0.79%
==========================================
Files 159 159
Lines 18318 18528 +210
==========================================
- Hits 11228 11211 -17
- Misses 6074 6223 +149
- Partials 1016 1094 +78
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
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.
Reviewed 24 of 25 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @dzmitryhil, @miladz68, and @ysv)
5ef0460
to
ec9e523
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.
Reviewed 4 of 4 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @dzmitryhil, @miladz68, and @ysv)
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.
Reviewable status: all files reviewed, 27 unresolved discussions (waiting on @masihyeganeh, @miladz68, and @ysv)
x/delay/keeper/keeper.go
line 100 at r3 (raw file):
store := k.storeService.OpenKVStore(ctx) if val, _ := store.Has(key); val {
You shouldn't ignore the error! Either return it or panic.
x/delay/keeper/keeper.go
line 132 at r3 (raw file):
store := k.storeService.OpenKVStore(ctx) if val, _ := store.Has(key); val {
You shouldn't ignore the error! Either return it or panic.
x/asset/nft/keeper/keeper.go
line 54 at r3 (raw file):
func (k Keeper) GetParams(ctx sdk.Context) types.Params { store := k.storeService.OpenKVStore(ctx) bz, _ := store.Get(types.ParamsKey)
You shouldn't ignore the error! Either return it or panic.
x/asset/nft/keeper/keeper.go
line 204 at r3 (raw file):
} bz, _ := k.storeService.OpenKVStore(ctx).Get(classKey)
You shouldn't ignore the error! Either return it or panic.
x/asset/nft/keeper/keeper.go
line 499 at r3 (raw file):
} isBurnt, _ := k.storeService.OpenKVStore(ctx).Get(key)
You shouldn't ignore the error! Either return it or panic.
x/asset/nft/keeper/keeper.go
line 671 at r3 (raw file):
} val, _ := store.Get(key)
You shouldn't ignore the error! Either return it or panic.
x/asset/nft/keeper/keeper.go
line 706 at r3 (raw file):
} val, _ := k.storeService.OpenKVStore(ctx).Get(key)
You shouldn't ignore the error! Either return it or panic.
x/asset/nft/keeper/keeper.go
line 888 at r3 (raw file):
} val, _ := k.storeService.OpenKVStore(ctx).Get(classKey)
You shouldn't ignore the error! Either return it or panic.
x/asset/nft/keeper/keeper.go
line 902 at r3 (raw file):
} val, _ := k.storeService.OpenKVStore(ctx).Get(key)
You shouldn't ignore the error! Either return it or panic.
x/asset/ft/keeper/keeper.go
line 76 at r3 (raw file):
// GetParams gets the parameters of the module. func (k Keeper) GetParams(ctx sdk.Context) types.Params { store := k.storeService.OpenKVStore(ctx)
In some cases you use
store := ctx.KVStore(k.storeKey)
store.Set()...
But in some
k.storeService.OpenKVStore(ctx).Set
Let's use one stile (2nd better IMO) for the case when we need it once in the func.
x/asset/ft/keeper/keeper.go
line 77 at r3 (raw file):
func (k Keeper) GetParams(ctx sdk.Context) types.Params { store := k.storeService.OpenKVStore(ctx) bz, _ := store.Get(types.ParamsKey)
You shouldn't ignore the error! Either return it or panic.
x/asset/ft/keeper/keeper.go
line 998 at r3 (raw file):
store := k.storeService.OpenKVStore(ctx) compositeKey := types.CreateSymbolKey(issuer, symbol) rawBytes, _ := store.Get(compositeKey)
You shouldn't ignore the error! Either return it or panic.
x/asset/ft/keeper/keeper.go
line 1158 at r3 (raw file):
func (k Keeper) isGloballyFrozen(ctx sdk.Context, denom string) bool { store := k.storeService.OpenKVStore(ctx) isGloballyFrozen, _ := store.Get(types.CreateGlobalFreezeKey(denom))
You shouldn't ignore the error! Either return it or panic.
x/dex/keeper/keeper_store.go
line 98 at r3 (raw file):
val proto.Message, ) error { bz, _ := k.storeService.OpenKVStore(ctx).Get(key)
You shouldn't ignore the error! Either return it or panic.
x/customparams/keeper/keeper.go
line 36 at r3 (raw file):
func (k Keeper) GetStakingParams(ctx sdk.Context) types.StakingParams { store := k.storeService.OpenKVStore(ctx) bz, _ := store.Get(types.StakingParamsKey)
You shouldn't ignore the error! Either return it or panic.
x/asset/ft/keeper/keeper_dex.go
line 120 at r3 (raw file):
// GetDEXSettings gets the DEX settings of a specified denom. func (k Keeper) GetDEXSettings(ctx sdk.Context, denom string) (types.DEXSettings, error) { bz, _ := k.storeService.OpenKVStore(ctx).Get(types.CreateDEXSettingsKey(denom))
You shouldn't ignore the error! Either return it or panic.
x/asset/ft/keeper/keeper_dex.go
line 569 at r3 (raw file):
} err = k.SetDEXSettings(ctx, denom, newSettings)
How about in-line error handling?
x/asset/ft/keeper/token_upgrade.go
line 54 at r3 (raw file):
store := k.storeService.OpenKVStore(ctx) key := types.CreatePendingTokenUpgradeKey(denom) if val, _ := store.Has(key); val {
You shouldn't ignore the error! Either return it or panic.
x/asset/ft/keeper/token_upgrade.go
line 70 at r3 (raw file):
// GetTokenUpgradeStatuses returns the token upgrade statuses of a specified denom. func (k Keeper) GetTokenUpgradeStatuses(ctx sdk.Context, denom string) types.TokenUpgradeStatuses { bz, _ := k.storeService.OpenKVStore(ctx).Get(types.CreateTokenUpgradeStatusesKey(denom))
You shouldn't ignore the error! Either return it or panic.
x/feemodel/keeper/keeper.go
line 43 at r3 (raw file):
gasUsed := sdkmath.NewInt(0) bz, _ := tStore.Get(gasTrackingKey)
You shouldn't ignore the error! Either return it or panic.
x/feemodel/keeper/keeper.go
line 77 at r3 (raw file):
func (k Keeper) GetParams(ctx sdk.Context) types.Params { store := k.storeService.OpenKVStore(ctx) bz, _ := store.Get(paramsKey)
You shouldn't ignore the error! Either return it or panic.
x/feemodel/keeper/keeper.go
line 126 at r3 (raw file):
func (k Keeper) GetLongEMAGas(ctx sdk.Context) int64 { store := k.storeService.OpenKVStore(ctx) bz, _ := store.Get(longEMAGasKey)
You shouldn't ignore the error! Either return it or panic.
x/feemodel/keeper/keeper.go
line 155 at r3 (raw file):
func (k Keeper) GetMinGasPrice(ctx sdk.Context) sdk.DecCoin { store := k.storeService.OpenKVStore(ctx) bz, _ := store.Get(gasPriceKey)
You shouldn't ignore the error! Either return it or panic.
x/dex/keeper/keeper.go
line 194 at r3 (raw file):
func (k Keeper) GetParams(ctx sdk.Context) types.Params { store := k.storeService.OpenKVStore(ctx) bz, _ := store.Get(types.ParamsKey)
You shouldn't ignore the error! Either return it or panic.
x/dex/keeper/keeper.go
line 734 at r3 (raw file):
} } err = k.removeOrderData(ctx, record.OrderSequence)
Good place for in-line error handling
x/dex/keeper/keeper.go
line 938 at r3 (raw file):
return nil, nil, err } s := k.storeService.OpenKVStore(ctx)
You call it differenly in different places, check it please.
x/dex/keeper/keeper.go
line 1227 at r3 (raw file):
} // save empty slice err = k.storeService.OpenKVStore(ctx).Set(key, make([]byte, 0))
Good place for in-line handling.
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.
Reviewable status: all files reviewed, 27 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @ysv)
x/asset/ft/keeper/keeper.go
line 76 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
In some cases you use
store := ctx.KVStore(k.storeKey) store.Set()...
But in some
k.storeService.OpenKVStore(ctx).SetLet's use one stile (2nd better IMO) for the case when we need it once in the func.
It is mostly used like the first style when store is needed in more than one line or if it is wrapped in a couple of function calls and using the second one makes it less readable. But I'll try to unify them everywhere in code
x/asset/ft/keeper/keeper.go
line 77 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
The error happens only if the key is nil
which in our case it will never be, so it's safe to not handle it
Source: cosmossdk.io/core/store/store.go
And I didn't want to add a new return value to functions everywhere for the case that doesn't happen. Let's discuss it in the meeting to decide if we should handle it or not
x/asset/ft/keeper/keeper_dex.go
line 569 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
How about in-line error handling?
Done.
x/dex/keeper/keeper.go
line 734 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
Good place for in-line error handling
Done.
x/dex/keeper/keeper.go
line 938 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You call it differenly in different places, check it please.
Done.
x/dex/keeper/keeper.go
line 1227 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
Good place for in-line handling.
Done.
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.
Reviewed 8 of 8 files at r4, all commit messages.
Reviewable status: all files reviewed, 27 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @ysv)
c5c1dff
to
d84fbb4
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.
Reviewable status: 9 of 52 files reviewed, 27 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @ysv)
x/asset/ft/keeper/keeper.go
line 998 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/asset/ft/keeper/keeper.go
line 1158 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/asset/ft/keeper/keeper_dex.go
line 120 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/asset/ft/keeper/token_upgrade.go
line 54 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/asset/ft/keeper/token_upgrade.go
line 70 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/asset/nft/keeper/keeper.go
line 54 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/asset/nft/keeper/keeper.go
line 204 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/asset/nft/keeper/keeper.go
line 499 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/asset/nft/keeper/keeper.go
line 671 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/asset/nft/keeper/keeper.go
line 706 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/asset/nft/keeper/keeper.go
line 888 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/asset/nft/keeper/keeper.go
line 902 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/customparams/keeper/keeper.go
line 36 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/delay/keeper/keeper.go
line 100 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/delay/keeper/keeper.go
line 132 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/dex/keeper/keeper.go
line 194 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/dex/keeper/keeper_store.go
line 98 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/feemodel/keeper/keeper.go
line 43 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/feemodel/keeper/keeper.go
line 77 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/feemodel/keeper/keeper.go
line 126 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
x/feemodel/keeper/keeper.go
line 155 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You shouldn't ignore the error! Either return it or panic.
Done.
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.
Reviewed 43 of 43 files at r5, all commit messages.
Reviewable status: all files reviewed, 27 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @ysv)
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.
Reviewed 9 of 25 files at r1, 1 of 3 files at r2, 2 of 8 files at r4, 43 of 43 files at r5, all commit messages.
Reviewable status: all files reviewed, 28 unresolved discussions (waiting on @dzmitryhil, @masihyeganeh, and @ysv)
x/asset/nft/keeper/keeper.go
line 692 at r5 (raw file):
} val, _ = store.Get(key)
same as Dima mentioned above.
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.
Dismissed @miladz68 from a discussion.
Reviewable status: 46 of 57 files reviewed, 27 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @ysv)
x/asset/nft/keeper/keeper.go
line 692 at r5 (raw file):
Previously, miladz68 (milad) wrote…
same as Dima mentioned above.
Done.
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.
Reviewed 9 of 11 files at r6, 2 of 2 files at r7, all commit messages.
Reviewable status: all files reviewed, 27 unresolved discussions (waiting on @dzmitryhil and @ysv)
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.
Reviewed 9 of 11 files at r6, 2 of 2 files at r7, all commit messages.
Reviewable status: all files reviewed, 27 unresolved discussions (waiting on @dzmitryhil and @ysv)
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.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ysv)
Description
Reviewers checklist:
Authors checklist
This change is