-
Notifications
You must be signed in to change notification settings - Fork 817
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
Ct queries #1927
Ct queries #1927
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/ct_types #1927 +/- ##
====================================================
- Coverage 61.36% 61.30% -0.06%
====================================================
Files 263 275 +12
Lines 23306 24427 +1121
====================================================
+ Hits 14301 14976 +675
- Misses 8001 8357 +356
- Partials 1004 1094 +90
|
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.
Looks good overall! With some small questions comments
message TestQueryResponse { | ||
string test_field = 1; | ||
message GetAllAccountsResponse { | ||
repeated CtAccount accounts = 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.
CtAccount itself does not have reference to the denom associated with the account - we should make sure this query responds with the names of the denoms that the address has accounts for
(actually that's probably the most important thing for this query, I think it's mostly useful to let users know what denoms some account has an confidential transfer accounts for, the user can then query that account directly to get the account details)
account, err := ctAccount.FromProto() | ||
if err != nil { | ||
return types.Account{}, false | ||
} | ||
return *account, true | ||
} | ||
|
||
func (k BaseKeeper) getCtAccount(ctx sdk.Context, address sdk.AccAddress, denom string) (types.CtAccount, bool) { |
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 do we need to have both getAccount and getCtAccount?
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.
Was experimenting with the implementation a bit, will remove duplicate code
store := ctx.KVStore(k.storeKey) | ||
key := types.GetAccountKey(address, denom) | ||
if !store.Has(key) { | ||
func (k BaseKeeper) getAccount(ctx sdk.Context, address sdk.AccAddress, denom string) (types.Account, bool) { |
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 think we need to export this method?
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 think I refactored it to be private, since the only usage rn is in the querier, and querier itself being a BaseKeeper
has GetAccount
method
account, err := ctAccount.FromProto() | ||
if err != nil { | ||
return types.Account{}, false | ||
} | ||
return *account, true | ||
} | ||
|
||
func (k BaseKeeper) getCtAccount(ctx sdk.Context, address sdk.AccAddress, denom string) (types.CtAccount, bool) { |
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.
Do we need to export this method as well?
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.
For now it's only used in in getAccount
so I would keep it as is for now.
* add genesis init/export tests * refactor store * confidential transfers queries * working draft test * more tests * refactor tests * all accounts query * formatting * add pagination to request/response * update implementation to use paginated response instead * formatting * remove redundant param * all accounts with denoms * clean up commented code * return GetAccount back to keeper * formatting
Describe your changes and provide context
Testing performed to validate your change