Merge PR #1889: update signing info endpoint

* update /slashing/signing_info/ endpoint of lcd to take cosmosvalpub instead of cosmosvaladdr for consistency reasons
* update pending.md
* update test that calls /slashing/signing-info endpoint
This commit is contained in:
Joe Bowman 2018-07-31 19:27:03 +01:00 committed by Christopher Goes
parent 19b0781e60
commit 874a6055b0
3 changed files with 7 additions and 7 deletions

View File

@ -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
* [types] sdk.NewCoin now takes sdk.Int, sdk.NewInt64Coin takes int64
FEATURES

View File

@ -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)
@ -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)

View File

@ -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)