Add Slashing Query Params (#3117)

This commit is contained in:
Alexander Bezobchuk
2018-12-14 11:09:39 -08:00
committed by Jack Zampolin
parent 65beea4430
commit 110fd63e22
12 changed files with 242 additions and 10 deletions
+1
View File
@@ -155,6 +155,7 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, baseAppOptio
app.QueryRouter().
AddRoute("gov", gov.NewQuerier(app.govKeeper)).
AddRoute(slashing.QuerierRoute, slashing.NewQuerier(app.slashingKeeper, app.cdc)).
AddRoute("stake", stake.NewQuerier(app.stakeKeeper, app.cdc))
// initialize BaseApp
+33
View File
@@ -9,6 +9,8 @@ import (
"path/filepath"
"testing"
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/types"
@@ -676,6 +678,37 @@ func TestGaiadCollectGentxs(t *testing.T) {
cleanupDirs(gaiadHome, gaiacliHome, gentxDir)
}
// ---------------------------------------------------------------------------
// Slashing
func TestSlashingGetParams(t *testing.T) {
t.Parallel()
cdc := app.MakeCodec()
chainID, servAddr, port, gaiadHome, gaiacliHome, p2pAddr := initializeFixtures(t)
flags := fmt.Sprintf("--home=%s --node=%v --chain-id=%v", gaiacliHome, servAddr, chainID)
// start gaiad server
proc := tests.GoExecuteTWithStdout(
t,
fmt.Sprintf(
"gaiad start --home=%s --rpc.laddr=%v --p2p.laddr=%v",
gaiadHome, servAddr, p2pAddr,
),
)
defer proc.Stop(false)
tests.WaitForTMStart(port)
tests.WaitForNextNBlocksTM(1, port)
res, errStr := tests.ExecuteT(t, fmt.Sprintf("gaiacli query slashing params %s", flags), "")
require.Empty(t, errStr)
var params slashing.Params
err := cdc.UnmarshalJSON([]byte(res), &params)
require.NoError(t, err)
}
//___________________________________________________________________________________
// helper methods