-
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
R4R: Redelegation endpoint and Querier #2336
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #2336 +/- ##
==========================================
Coverage ? 61.66%
==========================================
Files ? 122
Lines ? 7500
Branches ? 0
==========================================
Hits ? 4625
Misses ? 2553
Partials ? 322 |
@fedekunze What's the status of this PR? |
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, let's add the testcase once the upstream issue is fixed, thanks @fedekunze
c4cc30f
to
8bd3210
Compare
note: lint is failing on develop |
Do we really need |
@faboweb the query is to query individual redelegations, same as the existing endpoints to query individual delegations and unbonding delegations |
Merge develop, it will fix the linter. Not sure about |
yes, but why? in which case do I query for all redelegations between one validator and another validator? maybe for analytics. but there I will probably download bigger data sets and do not use a single query for each request. |
…edekunze/2182-redelegation-endpoint Pull
@alexanderbez You said that maybe the error had to do with the queue ? Cuz if I run the unit tests locally they pass |
Lets try to get this in for 0.25? cc @cwgoes |
Needs |
Is this affected by the non-determinism? |
I should be affected |
@fedekunze I think this test failure is unrelated to the CI nondeterminism, something about redelegation querying. |
@cwgoes I'm getting the same error on other branch as well without the redelegation query:
|
Yes, I believe the non-determinism is due to the new bonding/unbonding queue logic or at least correlated. |
Hmm, I see another error, e.g. https://circleci.com/gh/cosmos/cosmos-sdk/36899#tests/containers/2 - ok github.com/cosmos/cosmos-sdk/x/stake 5.546s coverage: 82.4% of statements
--- FAIL: TestQueryRedelegation (0.13s)
Error Trace: queryable_test.go:334
Error: Should be true
Test: TestQueryRedelegation
FAIL
coverage: 70.8% of statements
FAIL github.com/cosmos/cosmos-sdk/x/stake/querier 0.773s |
…edekunze/2182-redelegation-endpoint Pull
Failing test @fedekunze
|
|
||
w.Header().Set("Content-Type", "application/json") | ||
bech32ValidatorSrc := vars["validatorSrcAddr"] | ||
bech32ValidatorDst := vars["validatorDstAddr"] | ||
|
||
delegatorAddr, err := sdk.AccAddressFromBech32(bech32delegator) |
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.
Shouldn't we add
if err != nil {
utils.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
return
}
after each line? otherwise, err might end up overwritten by the subsequent calls
bech32delegator := vars["delegatorAddr"] | ||
bech32validator := vars["validatorAddr"] | ||
|
||
delegatorAddr, err := sdk.AccAddressFromBech32(bech32delegator) |
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 here
return | ||
} | ||
|
||
w.Header().Set("Content-Type", "application/json") |
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 this should be set per an API handler, not on individual endpoint level, no?
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 agree, the standarize error responses PR (#2444) refactors all this by using utils.PostProcessResponse(w, cdc, res, cliCtx.Indent)
which contains it
splitting and closing for #2537 |
Closes #2182
GET
redelegation endpointquery.go
to avoid duplicated codeTargeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added entries in
PENDING.md
with issue #Reviewed
Files changed
in the github PR explorerFor Admin Use: