-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
subspace queries + few more staking queries #969
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #969 +/- ##
===========================================
+ Coverage 60.9% 61.13% +0.23%
===========================================
Files 72 72
Lines 3512 3520 +8
===========================================
+ Hits 2139 2152 +13
+ Misses 1203 1198 -5
Partials 170 170 |
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.
Miscellaneous notes
types/store.go
Outdated
//---------------------------------------- | ||
|
||
// key-value result for iterator queries | ||
type KV struct { |
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.
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.
awesome will update for this
// get the command to query a candidate | ||
func GetCmdQueryCandidates(storeName string, cdc *wire.Codec) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "candidates", |
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.
What order are candidates returned in?
Maybe accept a limit (and offset) of the number of candidates to return?
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.
Candidates are returned in the stored order (by candidate owner address) yeah we could build in a limit, just one more thing to parse for in the path though, which is kind of confusing, it would probably need to use a different symbol such as a dash, ex. subspace-100
not sure I love this idea. I think it's maybe a bit too much complexity that we don't need in the query, you can manually filter after you get the results - also not concerned about limiting so much as per this issue: #975
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.
Fair enough, not a priority, agreed we want to avoid ugliness/complexity.
// get the command to query all the candidates bonded to a delegator | ||
func GetCmdQueryDelegatorBonds(storeName string, cdc *wire.Codec) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "delegator-candidates", |
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.
Same as above, maybe limit-offset (not sure if necessary for bonds) and clarity on sort order.
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.
see response above
x/stake/msg.go
Outdated
panic(err) | ||
} | ||
return b | ||
cdc := wire.NewCodec() |
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 create a new codec each call?
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.
struggling with how to use a basic cdc without needing to pass them all around. But, correct good point this can just be defined once here. I just don't like having to many cdc's lying around all over the place - have a solution in mind here though, shouldn't be too bad if we define it globally (with an init
function too) right above this message.
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.
A singleton for the file (or even just for all calls of this function) seems fine to me.
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.
yeah that's the plan - I just want the cdc definitions to be as consolidated as possible - it's more just stylistic clarity I'm thinking of
@@ -176,7 +176,16 @@ func (st *iavlStore) Query(req abci.RequestQuery) (res abci.ResponseQuery) { | |||
} else { | |||
_, res.Value = tree.GetVersioned(key, height) | |||
} | |||
|
|||
case "/subspace": |
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 want to support limit-offset queries?
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'm not a fan for the time being as per my upper comment - I think once we refine a way to pass in options instead of using the path, then I'm much more warm to this idea.
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.
utACK for now, limit/offset maybe to be added in the future (also need to think about DoS vectors, make sure clients can't force expensive store reads).
Also ref #979 re: store queries, will be implemented in a separate PR. |
@rigelrozanski is this backwards compatible with the current gaia-5000 testnet? Would love to be able to get this data for the current validator set |
unfortunately it's not because of unmarshalling format changes since then |
closes #871
partial #964