refactor!: use KVStoreService in x/auth#15520
Conversation
| store := ak.storeSvc.OpenKVStore(ctx) | ||
| has, err := store.Has(types.AddressStoreKey(addr)) | ||
| if err != nil { | ||
| panic(err) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
| store := ak.storeSvc.OpenKVStore(ctx) | ||
| bz, err := store.Get(types.AddressStoreKey(addr)) | ||
| if err != nil { | ||
| panic(err) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
…-sdk into facu/auth-storesvc
| func KVStoreAdapter(store store.KVStore) storetypes.KVStore { | ||
| return &kvStoreAdapter{store} | ||
| } |
There was a problem hiding this comment.
Not sure where to put this adapter, accepting suggestions :D
There was a problem hiding this comment.
why is this needed? the new interface returns errors can we use that or?
There was a problem hiding this comment.
Because there's the prefix store and the query.Paginate that take in the KVStore from /store/types instead of core. Once we migrate all modules we could remove this adapter and modify the other methods to take in the core KVStore.
There was a problem hiding this comment.
So yes, because the new interface returns errors so it's not compatible
| // Fix upstream GHSA-h395-qcrw-5vmq vulnerability. | ||
| // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 | ||
| replace github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.8.1 | ||
| replace github.com/cosmos/cosmos-sdk => ../../ |
There was a problem hiding this comment.
We can remove this once we tag
There was a problem hiding this comment.
We won't tag the SDK in a while, best to use a pseudo version of the SDK from this branch.
There was a problem hiding this comment.
Yeah, I realized later that we are not tagging x/auth separately
| func (s kvStoreAdapter) Set(key []byte, value []byte) { | ||
| err := s.store.Set(key, value) | ||
| if err != nil { | ||
| panic(err) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
| func (s kvStoreAdapter) Iterator(start []byte, end []byte) dbm.Iterator { | ||
| it, err := s.store.Iterator(start, end) | ||
| if err != nil { | ||
| panic(err) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
| func (s kvStoreAdapter) Delete(key []byte) { | ||
| err := s.store.Delete(key) | ||
| if err != nil { | ||
| panic(err) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
| func (s kvStoreAdapter) Get(key []byte) []byte { | ||
| bz, err := s.store.Get(key) | ||
| if err != nil { | ||
| panic(err) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
| func (s kvStoreAdapter) Has(key []byte) bool { | ||
| has, err := s.store.Has(key) | ||
| if err != nil { | ||
| panic(err) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
|
|
||
| // add keepers | ||
| app.AccountKeeper = authkeeper.NewAccountKeeper(appCodec, keys[authtypes.StoreKey], authtypes.ProtoBaseAccount, maccPerms, sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String()) | ||
| app.AccountKeeper = authkeeper.NewAccountKeeper(appCodec, runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String()) |
There was a problem hiding this comment.
Same comment as before about UPGRADING.md + changelog.
I think now the category can be generalized under simapp. Moreover, we should add that if chains are generating mocks for their own testing, they will need to re-generate them.
There was a problem hiding this comment.
Github is taking a while to update stuff here, but I've added a changelog entry and modified the upgrading doc.
julienrbrt
left a comment
There was a problem hiding this comment.
lgtm! left 2 comments.
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
| func KVStoreAdapter(store store.KVStore) storetypes.KVStore { | ||
| return &kvStoreAdapter{store} | ||
| } |
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Description
Right now we still pass the StoreKey to the Keeper instead of the service because we need it for pagination and prefix iteration (prefix.NewStoreandquery.Paginate). Should we do something about that now?query.Paginateandprefix.NewStore(not sure about where to put it)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.mdReviewers 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