Skip to content
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

update signing info endpoint #1889

Merged
merged 5 commits into from
Jul 31, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ BREAKING CHANGES
* `gaiacli gov vote --voter`
* [x/gov] Added tags sub-package, changed tags to use dash-case
* [x/gov] Governance parameters are now stored in globalparams store
* [lcd] \#1866 Updated lcd /slashing/signing_info endpoint to take cosmosvalpub instead of cosmosvaladdr

FEATURES
* [lcd] Can now query governance proposals by ProposalStatus
Expand Down
8 changes: 4 additions & 4 deletions client/lcd/lcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,8 @@ func TestUnrevoke(t *testing.T) {

// XXX: any less than this and it fails
tests.WaitForHeight(3, port)

signingInfo := getSigningInfo(t, port, sdk.ValAddress(pks[0].Address()))
pkString, _ := sdk.Bech32ifyValPub(pks[0])
signingInfo := getSigningInfo(t, port, pkString)
tests.WaitForHeight(4, port)
require.Equal(t, true, signingInfo.IndexOffset > 0)
require.Equal(t, int64(0), signingInfo.JailedUntil)
Expand Down Expand Up @@ -710,8 +710,8 @@ func doIBCTransfer(t *testing.T, port, seed, name, password string, addr sdk.Acc
return resultTx
}

func getSigningInfo(t *testing.T, port string, validatorAddr sdk.ValAddress) slashing.ValidatorSigningInfo {
res, body := Request(t, port, "GET", fmt.Sprintf("/slashing/signing_info/%s", validatorAddr), nil)
func getSigningInfo(t *testing.T, port string, validatorPubKey string) slashing.ValidatorSigningInfo {
res, body := Request(t, port, "GET", fmt.Sprintf("/slashing/signing_info/%s", validatorPubKey), nil)
require.Equal(t, http.StatusOK, res.StatusCode, body)
var signingInfo slashing.ValidatorSigningInfo
err := cdc.UnmarshalJSON([]byte(body), &signingInfo)
Expand Down
5 changes: 2 additions & 3 deletions x/slashing/client/rest/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@ func signingInfoHandlerFn(ctx context.CoreContext, storeName string, cdc *wire.C

// read parameters
vars := mux.Vars(r)
bech32validator := vars["validator"]

validatorAddr, err := sdk.ValAddressFromBech32(bech32validator)
pk, err := sdk.GetValPubKeyBech32(vars["validator"])
if err != nil {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte(err.Error()))
return
}

key := slashing.GetValidatorSigningInfoKey(validatorAddr)
key := slashing.GetValidatorSigningInfoKey(sdk.ValAddress(pk.Address()))
res, err := ctx.QueryStore(key, storeName)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
Expand Down