tools: Add unparam linter (#1443)

* tools: Add unparam linter

unparam detects unused parameters in functions, and a parameter to
a function which only ever takes on one value. The latter is an
indication that more tests are required.

There are many nolints in this PR, as I believe that writing tests
to fix alot of these situations is out of scope for this PR / it
will be changed in future commits. There are some nolints for
when we have to comply to normal api's.

* crypto/keys no longer used by x/gov/client/rest/rest.go
This commit is contained in:
Dev Ojha 2018-06-29 15:22:24 -07:00 committed by Rigel
parent 47e4682d9f
commit 097dd8a164
31 changed files with 102 additions and 72 deletions

View File

@ -42,6 +42,7 @@ FEATURES
* unconvert * unconvert
* ineffassign * ineffassign
* errcheck * errcheck
* unparam
* [tools] Add `make format` command to automate fixing misspell and gofmt errors. * [tools] Add `make format` command to automate fixing misspell and gofmt errors.
* [server] Default config now creates a profiler at port 6060, and increase p2p send/recv rates * [server] Default config now creates a profiler at port 6060, and increase p2p send/recv rates
* [tests] Add WaitForNextNBlocksTM helper method * [tests] Add WaitForNextNBlocksTM helper method

View File

@ -108,7 +108,7 @@ test_cover:
@bash tests/test_cover.sh @bash tests/test_cover.sh
test_lint: test_lint:
gometalinter.v2 --disable-all --enable='golint' --enable='misspell' --enable='unconvert' --enable='ineffassign' --linter='vet:go vet -composites=false:PATH:LINE:MESSAGE' --enable='vet' --deadline=500s --vendor ./... gometalinter.v2 --disable-all --enable='golint' --enable='misspell' --enable='unparam' --enable='unconvert' --enable='ineffassign' --linter='vet:go vet -composites=false:PATH:LINE:MESSAGE' --enable='vet' --deadline=500s --vendor ./...
!(gometalinter.v2 --disable-all --enable='errcheck' --vendor ./... | grep -v "client/") !(gometalinter.v2 --disable-all --enable='errcheck' --vendor ./... | grep -v "client/")
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s

View File

@ -76,7 +76,7 @@ func createHandler(cdc *wire.Codec) http.Handler {
// TODO make more functional? aka r = keys.RegisterRoutes(r) // TODO make more functional? aka r = keys.RegisterRoutes(r)
r.HandleFunc("/version", CLIVersionRequestHandler).Methods("GET") r.HandleFunc("/version", CLIVersionRequestHandler).Methods("GET")
r.HandleFunc("/node_version", NodeVersionRequestHandler(cdc, ctx)).Methods("GET") r.HandleFunc("/node_version", NodeVersionRequestHandler(ctx)).Methods("GET")
keys.RegisterRoutes(r) keys.RegisterRoutes(r)
rpc.RegisterRoutes(ctx, r) rpc.RegisterRoutes(ctx, r)
tx.RegisterRoutes(ctx, r, cdc) tx.RegisterRoutes(ctx, r, cdc)
@ -84,6 +84,6 @@ func createHandler(cdc *wire.Codec) http.Handler {
bank.RegisterRoutes(ctx, r, cdc, kb) bank.RegisterRoutes(ctx, r, cdc, kb)
ibc.RegisterRoutes(ctx, r, cdc, kb) ibc.RegisterRoutes(ctx, r, cdc, kb)
stake.RegisterRoutes(ctx, r, cdc, kb) stake.RegisterRoutes(ctx, r, cdc, kb)
gov.RegisterRoutes(ctx, r, cdc, kb) gov.RegisterRoutes(ctx, r, cdc)
return r return r
} }

View File

@ -132,7 +132,7 @@ func InitializeTestLCD(t *testing.T, nValidators int, initAddrs []sdk.Address) (
for _, gdValidator := range genDoc.Validators { for _, gdValidator := range genDoc.Validators {
pk := gdValidator.PubKey pk := gdValidator.PubKey
validatorsPKs = append(validatorsPKs, pk) // append keys for output validatorsPKs = append(validatorsPKs, pk) // append keys for output
appGenTx, _, _, err := gapp.GaiaAppGenTxNF(cdc, pk, pk.Address(), "test_val1", true) appGenTx, _, _, err := gapp.GaiaAppGenTxNF(cdc, pk, pk.Address(), "test_val1")
require.NoError(t, err) require.NoError(t, err)
appGenTxs = append(appGenTxs, appGenTx) appGenTxs = append(appGenTxs, appGenTx)
} }

View File

@ -6,7 +6,6 @@ import (
"github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/wire"
) )
// cli version REST handler endpoint // cli version REST handler endpoint
@ -16,7 +15,7 @@ func CLIVersionRequestHandler(w http.ResponseWriter, r *http.Request) {
} }
// connected node version REST handler endpoint // connected node version REST handler endpoint
func NodeVersionRequestHandler(cdc *wire.Codec, ctx context.CoreContext) http.HandlerFunc { func NodeVersionRequestHandler(ctx context.CoreContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
version, err := ctx.Query("/app/version") version, err := ctx.Query("/app/version")
if err != nil { if err != nil {

View File

@ -129,6 +129,7 @@ func (app *GaiaApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) ab
} }
// application updates every end block // application updates every end block
// nolint: unparam
func (app *GaiaApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { func (app *GaiaApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
validatorUpdates := stake.EndBlocker(ctx, app.stakeKeeper) validatorUpdates := stake.EndBlocker(ctx, app.stakeKeeper)

View File

@ -103,12 +103,12 @@ func GaiaAppGenTx(cdc *wire.Codec, pk crypto.PubKey, genTxConfig config.GenTx) (
cliPrint = json.RawMessage(bz) cliPrint = json.RawMessage(bz)
appGenTx, _, validator, err = GaiaAppGenTxNF(cdc, pk, addr, genTxConfig.Name, genTxConfig.Overwrite) appGenTx, _, validator, err = GaiaAppGenTxNF(cdc, pk, addr, genTxConfig.Name)
return return
} }
// Generate a gaia genesis transaction without flags // Generate a gaia genesis transaction without flags
func GaiaAppGenTxNF(cdc *wire.Codec, pk crypto.PubKey, addr sdk.Address, name string, overwrite bool) ( func GaiaAppGenTxNF(cdc *wire.Codec, pk crypto.PubKey, addr sdk.Address, name string) (
appGenTx, cliPrint json.RawMessage, validator tmtypes.GenesisValidator, err error) { appGenTx, cliPrint json.RawMessage, validator tmtypes.GenesisValidator, err error) {
var bz []byte var bz []byte

View File

@ -210,6 +210,7 @@ func (app *GaiaApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) ab
} }
// application updates every end block // application updates every end block
// nolint: unparam
func (app *GaiaApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { func (app *GaiaApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
validatorUpdates := stake.EndBlocker(ctx, app.stakeKeeper) validatorUpdates := stake.EndBlocker(ctx, app.stakeKeeper)

View File

@ -120,6 +120,7 @@ func (app *BasecoinApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock
} }
// application updates every end block // application updates every end block
// nolint: unparam
func (app *BasecoinApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { func (app *BasecoinApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
validatorUpdates := stake.EndBlocker(ctx, app.stakeKeeper) validatorUpdates := stake.EndBlocker(ctx, app.stakeKeeper)

View File

@ -117,6 +117,7 @@ func MakeCodec() *wire.Codec {
} }
// custom logic for democoin initialization // custom logic for democoin initialization
// nolint: unparam
func (app *DemocoinApp) initChainerFn(coolKeeper cool.Keeper, powKeeper pow.Keeper) sdk.InitChainer { func (app *DemocoinApp) initChainerFn(coolKeeper cool.Keeper, powKeeper pow.Keeper) sdk.InitChainer {
return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
stateJSON := req.AppStateBytes stateJSON := req.AppStateBytes

View File

@ -32,6 +32,7 @@ func ErrEmptyStake(codespace sdk.CodespaceType) sdk.Error {
// ----------------------------- // -----------------------------
// Helpers // Helpers
// nolint: unparam
func newError(codespace sdk.CodespaceType, code sdk.CodeType, msg string) sdk.Error { func newError(codespace sdk.CodespaceType, code sdk.CodeType, msg string) sdk.Error {
return sdk.NewError(codespace, code, msg) return sdk.NewError(codespace, code, msg)
} }

View File

@ -7,18 +7,18 @@ import (
// NewHandler returns a handler for "simplestake" type messages. // NewHandler returns a handler for "simplestake" type messages.
func NewHandler(k Keeper) sdk.Handler { func NewHandler(k Keeper) sdk.Handler {
return func(ctx sdk.Context, msg sdk.Msg) sdk.Result { return func(ctx sdk.Context, msg sdk.Msg) sdk.Result {
switch msg := msg.(type) { switch msg.(type) {
case MsgBond: case MsgBond:
return handleMsgBond(ctx, k, msg) return handleMsgBond()
case MsgUnbond: case MsgUnbond:
return handleMsgUnbond(ctx, k, msg) return handleMsgUnbond()
default: default:
return sdk.ErrUnknownRequest("No match for message type.").Result() return sdk.ErrUnknownRequest("No match for message type.").Result()
} }
} }
} }
func handleMsgBond(ctx sdk.Context, k Keeper, msg MsgBond) sdk.Result { func handleMsgBond() sdk.Result {
// Removed ValidatorSet from result because it does not get used. // Removed ValidatorSet from result because it does not get used.
// TODO: Implement correct bond/unbond handling // TODO: Implement correct bond/unbond handling
return sdk.Result{ return sdk.Result{
@ -26,7 +26,7 @@ func handleMsgBond(ctx sdk.Context, k Keeper, msg MsgBond) sdk.Result {
} }
} }
func handleMsgUnbond(ctx sdk.Context, k Keeper, msg MsgUnbond) sdk.Result { func handleMsgUnbond() sdk.Result {
return sdk.Result{ return sdk.Result{
Code: sdk.ABCICodeOK, Code: sdk.ABCICodeOK,
} }

View File

@ -226,7 +226,7 @@ func initWithConfig(cdc *wire.Codec, appInit AppInit, config *cfg.Config, initCo
var persistentPeers string var persistentPeers string
if initConfig.GenTxs { if initConfig.GenTxs {
validators, appGenTxs, persistentPeers, err = processGenTxs(initConfig.GenTxsDir, cdc, appInit) validators, appGenTxs, persistentPeers, err = processGenTxs(initConfig.GenTxsDir, cdc)
if err != nil { if err != nil {
return return
} }
@ -263,7 +263,7 @@ func initWithConfig(cdc *wire.Codec, appInit AppInit, config *cfg.Config, initCo
} }
// append a genesis-piece // append a genesis-piece
func processGenTxs(genTxsDir string, cdc *wire.Codec, appInit AppInit) ( func processGenTxs(genTxsDir string, cdc *wire.Codec) (
validators []tmtypes.GenesisValidator, appGenTxs []json.RawMessage, persistentPeers string, err error) { validators []tmtypes.GenesisValidator, appGenTxs []json.RawMessage, persistentPeers string, err error) {
var fos []os.FileInfo var fos []os.FileInfo

View File

@ -115,6 +115,6 @@ func (kv kvStore) ReverseSubspaceIterator(prefix []byte) sdk.Iterator {
panic("not implemented") panic("not implemented")
} }
func NewCommitMultiStore(db dbm.DB) sdk.CommitMultiStore { func NewCommitMultiStore() sdk.CommitMultiStore {
return multiStore{kv: make(map[sdk.StoreKey]kvStore)} return multiStore{kv: make(map[sdk.StoreKey]kvStore)}
} }

View File

@ -12,7 +12,7 @@ import (
func TestStore(t *testing.T) { func TestStore(t *testing.T) {
db := dbm.NewMemDB() db := dbm.NewMemDB()
cms := NewCommitMultiStore(db) cms := NewCommitMultiStore()
key := sdk.NewKVStoreKey("test") key := sdk.NewKVStoreKey("test")
cms.MountStoreWithDB(key, sdk.StoreTypeIAVL, db) cms.MountStoreWithDB(key, sdk.StoreTypeIAVL, db)

View File

@ -47,6 +47,8 @@ type iavlStore struct {
} }
// CONTRACT: tree should be fully loaded. // CONTRACT: tree should be fully loaded.
// TODO: use more numHistory's, so the below nolint can be removed
// nolint: unparam
func newIAVLStore(tree *iavl.VersionedTree, numHistory int64) *iavlStore { func newIAVLStore(tree *iavl.VersionedTree, numHistory int64) *iavlStore {
st := &iavlStore{ st := &iavlStore{
tree: tree, tree: tree,

View File

@ -11,6 +11,7 @@ UNCONVERT = github.com/mdempsky/unconvert
INEFFASSIGN = github.com/gordonklaus/ineffassign INEFFASSIGN = github.com/gordonklaus/ineffassign
MISSPELL = github.com/client9/misspell/cmd/misspell MISSPELL = github.com/client9/misspell/cmd/misspell
ERRCHECK = github.com/kisielk/errcheck ERRCHECK = github.com/kisielk/errcheck
UNPARAM = mvdan.cc/unparam
DEP_CHECK := $(shell command -v dep 2> /dev/null) DEP_CHECK := $(shell command -v dep 2> /dev/null)
GOLINT_CHECK := $(shell command -v golint 2> /dev/null) GOLINT_CHECK := $(shell command -v golint 2> /dev/null)
@ -19,6 +20,7 @@ UNCONVERT_CHECK := $(shell command -v unconvert 2> /dev/null)
INEFFASSIGN_CHECK := $(shell command -v ineffassign 2> /dev/null) INEFFASSIGN_CHECK := $(shell command -v ineffassign 2> /dev/null)
MISSPELL_CHECK := $(shell command -v misspell 2> /dev/null) MISSPELL_CHECK := $(shell command -v misspell 2> /dev/null)
ERRCHECK_CHECK := $(shell command -v errcheck 2> /dev/null) ERRCHECK_CHECK := $(shell command -v errcheck 2> /dev/null)
UNPARAM_CHECK := $(shell command -v unparam 2> /dev/null)
check_tools: check_tools:
ifndef DEP_CHECK ifndef DEP_CHECK
@ -51,11 +53,16 @@ ifndef MISSPELL_CHECK
else else
@echo "Found misspell in path." @echo "Found misspell in path."
endif endif
ifndef MISSPELL_CHECK ifndef ERRCHECK_CHECK
@echo "No errcheck in path. Install with 'make get_tools'." @echo "No errcheck in path. Install with 'make get_tools'."
else else
@echo "Found errcheck in path." @echo "Found errcheck in path."
endif endif
ifndef UNPARAM_CHECK
@echo "No unparam in path. Install with 'make get_tools'."
else
@echo "Found unparam in path."
endif
get_tools: get_tools:
ifdef DEP_CHECK ifdef DEP_CHECK
@ -95,11 +102,17 @@ else
go get -v $(MISSPELL) go get -v $(MISSPELL)
endif endif
ifdef ERRCHECK_CHECK ifdef ERRCHECK_CHECK
@echo "misspell is already installed. Run 'make update_tools' to update." @echo "errcheck is already installed. Run 'make update_tools' to update."
else else
@echo "Installing misspell" @echo "Installing errcheck"
go get -v $(ERRCHECK) go get -v $(ERRCHECK)
endif endif
ifdef UNPARAM_CHECK
@echo "unparam is already installed. Run 'make update_tools' to update."
else
@echo "Installing unparam"
go get -v $(UNPARAM)
endif
update_tools: update_tools:
@echo "Updating dep" @echo "Updating dep"
@ -116,6 +129,8 @@ update_tools:
go get -u -v $(MISSPELL) go get -u -v $(MISSPELL)
@echo "Updating errcheck" @echo "Updating errcheck"
go get -u -v $(ERRCHECK) go get -u -v $(ERRCHECK)
@echo "Updating unparam"
go get -u -v $(UNPARAM)
# To avoid unintended conflicts with file names, always add to .PHONY # To avoid unintended conflicts with file names, always add to .PHONY
# unless there is a reason not to. # unless there is a reason not to.

View File

@ -76,7 +76,7 @@ func incrementAllSequenceNumbers(initSeqNums []int64) {
} }
// check a transaction result // check a transaction result
func SignCheck(t *testing.T, app *baseapp.BaseApp, msgs []sdk.Msg, accnums []int64, seq []int64, priv ...crypto.PrivKeyEd25519) sdk.Result { func SignCheck(app *baseapp.BaseApp, msgs []sdk.Msg, accnums []int64, seq []int64, priv ...crypto.PrivKeyEd25519) sdk.Result {
tx := GenTx(msgs, accnums, seq, priv...) tx := GenTx(msgs, accnums, seq, priv...)
res := app.Check(tx) res := app.Check(tx)
return res return res

View File

@ -6,7 +6,6 @@ import (
"strconv" "strconv"
"github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/crypto/keys"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/wire" "github.com/cosmos/cosmos-sdk/wire"
"github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/gov"
@ -20,19 +19,20 @@ const (
RestProposalID = "proposalID" RestProposalID = "proposalID"
RestDepositer = "depositer" RestDepositer = "depositer"
RestVoter = "voter" RestVoter = "voter"
storeName = "gov"
) )
// RegisterRoutes - Central function to define routes that get registered by the main application // RegisterRoutes - Central function to define routes that get registered by the main application
func RegisterRoutes(ctx context.CoreContext, r *mux.Router, cdc *wire.Codec, kb keys.Keybase) { func RegisterRoutes(ctx context.CoreContext, r *mux.Router, cdc *wire.Codec) {
r.HandleFunc("/gov/proposals", postProposalHandlerFn(cdc, kb, ctx)).Methods("POST") r.HandleFunc("/gov/proposals", postProposalHandlerFn(cdc, ctx)).Methods("POST")
r.HandleFunc(fmt.Sprintf("/gov/proposals/{%s}/deposits", RestProposalID), depositHandlerFn(cdc, kb, ctx)).Methods("POST") r.HandleFunc(fmt.Sprintf("/gov/proposals/{%s}/deposits", RestProposalID), depositHandlerFn(cdc, ctx)).Methods("POST")
r.HandleFunc(fmt.Sprintf("/gov/proposals/{%s}/votes", RestProposalID), voteHandlerFn(cdc, kb, ctx)).Methods("POST") r.HandleFunc(fmt.Sprintf("/gov/proposals/{%s}/votes", RestProposalID), voteHandlerFn(cdc, ctx)).Methods("POST")
r.HandleFunc(fmt.Sprintf("/gov/proposals/{%s}", RestProposalID), queryProposalHandlerFn("gov", cdc, kb, ctx)).Methods("GET") r.HandleFunc(fmt.Sprintf("/gov/proposals/{%s}", RestProposalID), queryProposalHandlerFn(cdc)).Methods("GET")
r.HandleFunc(fmt.Sprintf("/gov/proposals/{%s}/deposits/{%s}", RestProposalID, RestDepositer), queryDepositHandlerFn("gov", cdc, kb, ctx)).Methods("GET") r.HandleFunc(fmt.Sprintf("/gov/proposals/{%s}/deposits/{%s}", RestProposalID, RestDepositer), queryDepositHandlerFn(cdc)).Methods("GET")
r.HandleFunc(fmt.Sprintf("/gov/proposals/{%s}/votes/{%s}", RestProposalID, RestVoter), queryVoteHandlerFn("gov", cdc, kb, ctx)).Methods("GET") r.HandleFunc(fmt.Sprintf("/gov/proposals/{%s}/votes/{%s}", RestProposalID, RestVoter), queryVoteHandlerFn(cdc)).Methods("GET")
r.HandleFunc("/gov/proposals", queryProposalsWithParameterFn("gov", cdc, kb, ctx)).Methods("GET") r.HandleFunc("/gov/proposals", queryProposalsWithParameterFn(cdc)).Methods("GET")
} }
type postProposalReq struct { type postProposalReq struct {
@ -56,7 +56,7 @@ type voteReq struct {
Option string `json:"option"` // option from OptionSet chosen by the voter Option string `json:"option"` // option from OptionSet chosen by the voter
} }
func postProposalHandlerFn(cdc *wire.Codec, kb keys.Keybase, ctx context.CoreContext) http.HandlerFunc { func postProposalHandlerFn(cdc *wire.Codec, ctx context.CoreContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req postProposalReq var req postProposalReq
err := buildReq(w, r, cdc, &req) err := buildReq(w, r, cdc, &req)
@ -93,7 +93,7 @@ func postProposalHandlerFn(cdc *wire.Codec, kb keys.Keybase, ctx context.CoreCon
} }
} }
func depositHandlerFn(cdc *wire.Codec, kb keys.Keybase, ctx context.CoreContext) http.HandlerFunc { func depositHandlerFn(cdc *wire.Codec, ctx context.CoreContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r) vars := mux.Vars(r)
strProposalID := vars[RestProposalID] strProposalID := vars[RestProposalID]
@ -141,7 +141,7 @@ func depositHandlerFn(cdc *wire.Codec, kb keys.Keybase, ctx context.CoreContext)
} }
} }
func voteHandlerFn(cdc *wire.Codec, kb keys.Keybase, ctx context.CoreContext) http.HandlerFunc { func voteHandlerFn(cdc *wire.Codec, ctx context.CoreContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r) vars := mux.Vars(r)
strProposalID := vars[RestProposalID] strProposalID := vars[RestProposalID]
@ -195,7 +195,7 @@ func voteHandlerFn(cdc *wire.Codec, kb keys.Keybase, ctx context.CoreContext) ht
} }
} }
func queryProposalHandlerFn(storeName string, cdc *wire.Codec, kb keys.Keybase, ctx context.CoreContext) http.HandlerFunc { func queryProposalHandlerFn(cdc *wire.Codec) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r) vars := mux.Vars(r)
strProposalID := vars[RestProposalID] strProposalID := vars[RestProposalID]
@ -236,7 +236,7 @@ func queryProposalHandlerFn(storeName string, cdc *wire.Codec, kb keys.Keybase,
} }
} }
func queryDepositHandlerFn(storeName string, cdc *wire.Codec, kb keys.Keybase, ctx context.CoreContext) http.HandlerFunc { func queryDepositHandlerFn(cdc *wire.Codec) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r) vars := mux.Vars(r)
strProposalID := vars[RestProposalID] strProposalID := vars[RestProposalID]
@ -302,7 +302,7 @@ func queryDepositHandlerFn(storeName string, cdc *wire.Codec, kb keys.Keybase, c
} }
} }
func queryVoteHandlerFn(storeName string, cdc *wire.Codec, kb keys.Keybase, ctx context.CoreContext) http.HandlerFunc { func queryVoteHandlerFn(cdc *wire.Codec) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r) vars := mux.Vars(r)
strProposalID := vars[RestProposalID] strProposalID := vars[RestProposalID]
@ -369,7 +369,7 @@ func queryVoteHandlerFn(storeName string, cdc *wire.Codec, kb keys.Keybase, ctx
} }
} }
func queryProposalsWithParameterFn(storeName string, cdc *wire.Codec, kb keys.Keybase, ctx context.CoreContext) http.HandlerFunc { func queryProposalsWithParameterFn(cdc *wire.Codec) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
bechVoterAddr := r.URL.Query().Get(RestVoter) bechVoterAddr := r.URL.Query().Get(RestVoter)
bechDepositerAddr := r.URL.Query().Get(RestDepositer) bechDepositerAddr := r.URL.Query().Get(RestDepositer)

View File

@ -114,7 +114,7 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) (tags sdk.Tags, nonVotingVals []
for shouldPopActiveProposalQueue(ctx, keeper) { for shouldPopActiveProposalQueue(ctx, keeper) {
activeProposal := keeper.ActiveProposalQueuePop(ctx) activeProposal := keeper.ActiveProposalQueuePop(ctx)
if ctx.BlockHeight() >= activeProposal.GetVotingStartBlock()+keeper.GetVotingProcedure(ctx).VotingPeriod { if ctx.BlockHeight() >= activeProposal.GetVotingStartBlock()+keeper.GetVotingProcedure().VotingPeriod {
passes, nonVotingVals = tally(ctx, keeper, activeProposal) passes, nonVotingVals = tally(ctx, keeper, activeProposal)
proposalIDBytes := keeper.cdc.MustMarshalBinaryBare(activeProposal.GetProposalID()) proposalIDBytes := keeper.cdc.MustMarshalBinaryBare(activeProposal.GetProposalID())
if passes { if passes {
@ -136,7 +136,7 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) (tags sdk.Tags, nonVotingVals []
return tags, nonVotingVals return tags, nonVotingVals
} }
func shouldPopInactiveProposalQueue(ctx sdk.Context, keeper Keeper) bool { func shouldPopInactiveProposalQueue(ctx sdk.Context, keeper Keeper) bool {
depositProcedure := keeper.GetDepositProcedure(ctx) depositProcedure := keeper.GetDepositProcedure()
peekProposal := keeper.InactiveProposalQueuePeek(ctx) peekProposal := keeper.InactiveProposalQueuePeek(ctx)
if peekProposal == nil { if peekProposal == nil {
@ -150,7 +150,7 @@ func shouldPopInactiveProposalQueue(ctx sdk.Context, keeper Keeper) bool {
} }
func shouldPopActiveProposalQueue(ctx sdk.Context, keeper Keeper) bool { func shouldPopActiveProposalQueue(ctx sdk.Context, keeper Keeper) bool {
votingProcedure := keeper.GetVotingProcedure(ctx) votingProcedure := keeper.GetVotingProcedure()
peekProposal := keeper.ActiveProposalQueuePeek(ctx) peekProposal := keeper.ActiveProposalQueuePeek(ctx)
if peekProposal == nil { if peekProposal == nil {

View File

@ -129,7 +129,7 @@ func (keeper Keeper) activateVotingPeriod(ctx sdk.Context, proposal Proposal) {
// Procedures // Procedures
// Gets procedure from store. TODO: move to global param store and allow for updating of this // Gets procedure from store. TODO: move to global param store and allow for updating of this
func (keeper Keeper) GetDepositProcedure(ctx sdk.Context) DepositProcedure { func (keeper Keeper) GetDepositProcedure() DepositProcedure {
return DepositProcedure{ return DepositProcedure{
MinDeposit: sdk.Coins{sdk.NewCoin("steak", 10)}, MinDeposit: sdk.Coins{sdk.NewCoin("steak", 10)},
MaxDepositPeriod: 200, MaxDepositPeriod: 200,
@ -137,14 +137,14 @@ func (keeper Keeper) GetDepositProcedure(ctx sdk.Context) DepositProcedure {
} }
// Gets procedure from store. TODO: move to global param store and allow for updating of this // Gets procedure from store. TODO: move to global param store and allow for updating of this
func (keeper Keeper) GetVotingProcedure(ctx sdk.Context) VotingProcedure { func (keeper Keeper) GetVotingProcedure() VotingProcedure {
return VotingProcedure{ return VotingProcedure{
VotingPeriod: 200, VotingPeriod: 200,
} }
} }
// Gets procedure from store. TODO: move to global param store and allow for updating of this // Gets procedure from store. TODO: move to global param store and allow for updating of this
func (keeper Keeper) GetTallyingProcedure(ctx sdk.Context) TallyingProcedure { func (keeper Keeper) GetTallyingProcedure() TallyingProcedure {
return TallyingProcedure{ return TallyingProcedure{
Threshold: sdk.NewRat(1, 2), Threshold: sdk.NewRat(1, 2),
Veto: sdk.NewRat(1, 3), Veto: sdk.NewRat(1, 3),
@ -256,7 +256,7 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID int64, depositerAddr
// Check if deposit tipped proposal into voting period // Check if deposit tipped proposal into voting period
// Active voting period if so // Active voting period if so
activatedVotingPeriod := false activatedVotingPeriod := false
if proposal.GetStatus() == StatusDepositPeriod && proposal.GetTotalDeposit().IsGTE(keeper.GetDepositProcedure(ctx).MinDeposit) { if proposal.GetStatus() == StatusDepositPeriod && proposal.GetTotalDeposit().IsGTE(keeper.GetDepositProcedure().MinDeposit) {
keeper.activateVotingPeriod(ctx, proposal) keeper.activateVotingPeriod(ctx, proposal)
activatedVotingPeriod = true activatedVotingPeriod = true
} }

View File

@ -81,7 +81,7 @@ func tally(ctx sdk.Context, keeper Keeper, proposal Proposal) (passes bool, nonV
totalVotingPower = totalVotingPower.Add(votingPower) totalVotingPower = totalVotingPower.Add(votingPower)
} }
tallyingProcedure := keeper.GetTallyingProcedure(ctx) tallyingProcedure := keeper.GetTallyingProcedure()
// If no one votes, proposal fails // If no one votes, proposal fails
if totalVotingPower.Sub(results[OptionAbstain]).Equal(sdk.ZeroRat()) { if totalVotingPower.Sub(results[OptionAbstain]).Equal(sdk.ZeroRat()) {

View File

@ -71,6 +71,7 @@ func IBCRelayCmd(cdc *wire.Codec) *cobra.Command {
return cmd return cmd
} }
// nolint: unparam
func (c relayCommander) runIBCRelay(cmd *cobra.Command, args []string) { func (c relayCommander) runIBCRelay(cmd *cobra.Command, args []string) {
fromChainID := viper.GetString(FlagFromChainID) fromChainID := viper.GetString(FlagFromChainID)
fromChainNode := viper.GetString(FlagFromChainNode) fromChainNode := viper.GetString(FlagFromChainNode)

View File

@ -36,6 +36,7 @@ func ErrIdenticalChains(codespace sdk.CodespaceType) sdk.Error {
// ------------------------- // -------------------------
// Helpers // Helpers
// nolint: unparam
func newError(codespace sdk.CodespaceType, code sdk.CodeType, msg string) sdk.Error { func newError(codespace sdk.CodespaceType, code sdk.CodeType, msg string) sdk.Error {
msg = msgOrDefaultMsg(msg, code) msg = msgOrDefaultMsg(msg, code)
return sdk.NewError(codespace, code, msg) return sdk.NewError(codespace, code, msg)

View File

@ -108,6 +108,6 @@ func TestSlashingMsgs(t *testing.T) {
checkValidatorSigningInfo(t, mapp, keeper, addr1, false) checkValidatorSigningInfo(t, mapp, keeper, addr1, false)
// unrevoke should fail with unknown validator // unrevoke should fail with unknown validator
res := mock.SignCheck(t, mapp.BaseApp, []sdk.Msg{unrevokeMsg}, []int64{0}, []int64{1}, priv1) res := mock.SignCheck(mapp.BaseApp, []sdk.Msg{unrevokeMsg}, []int64{0}, []int64{1}, priv1)
require.Equal(t, sdk.ToABCICode(DefaultCodespace, CodeInvalidValidator), res.Code) require.Equal(t, sdk.ToABCICode(DefaultCodespace, CodeInvalidValidator), res.Code)
} }

View File

@ -12,31 +12,33 @@ import (
"github.com/cosmos/cosmos-sdk/x/stake" "github.com/cosmos/cosmos-sdk/x/stake"
) )
const storeName = "stake"
func registerQueryRoutes(ctx context.CoreContext, r *mux.Router, cdc *wire.Codec) { func registerQueryRoutes(ctx context.CoreContext, r *mux.Router, cdc *wire.Codec) {
r.HandleFunc( r.HandleFunc(
"/stake/{delegator}/delegation/{validator}", "/stake/{delegator}/delegation/{validator}",
delegationHandlerFn(ctx, "stake", cdc), delegationHandlerFn(ctx, cdc),
).Methods("GET") ).Methods("GET")
r.HandleFunc( r.HandleFunc(
"/stake/{delegator}/ubd/{validator}", "/stake/{delegator}/ubd/{validator}",
ubdHandlerFn(ctx, "stake", cdc), ubdHandlerFn(ctx, cdc),
).Methods("GET") ).Methods("GET")
r.HandleFunc( r.HandleFunc(
"/stake/{delegator}/red/{validator_src}/{validator_dst}", "/stake/{delegator}/red/{validator_src}/{validator_dst}",
redHandlerFn(ctx, "stake", cdc), redHandlerFn(ctx, cdc),
).Methods("GET") ).Methods("GET")
r.HandleFunc( r.HandleFunc(
"/stake/validators", "/stake/validators",
validatorsHandlerFn(ctx, "stake", cdc), validatorsHandlerFn(ctx, cdc),
).Methods("GET") ).Methods("GET")
} }
// http request handler to query a delegation // http request handler to query a delegation
func delegationHandlerFn(ctx context.CoreContext, storeName string, cdc *wire.Codec) http.HandlerFunc { func delegationHandlerFn(ctx context.CoreContext, cdc *wire.Codec) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
// read parameters // read parameters
@ -93,7 +95,7 @@ func delegationHandlerFn(ctx context.CoreContext, storeName string, cdc *wire.Co
} }
// http request handler to query an unbonding-delegation // http request handler to query an unbonding-delegation
func ubdHandlerFn(ctx context.CoreContext, storeName string, cdc *wire.Codec) http.HandlerFunc { func ubdHandlerFn(ctx context.CoreContext, cdc *wire.Codec) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
// read parameters // read parameters
@ -150,7 +152,7 @@ func ubdHandlerFn(ctx context.CoreContext, storeName string, cdc *wire.Codec) ht
} }
// http request handler to query an redelegation // http request handler to query an redelegation
func redHandlerFn(ctx context.CoreContext, storeName string, cdc *wire.Codec) http.HandlerFunc { func redHandlerFn(ctx context.CoreContext, cdc *wire.Codec) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
// read parameters // read parameters
@ -271,7 +273,7 @@ func bech32StakeValidatorOutput(validator stake.Validator) (StakeValidatorOutput
// TODO bech32 // TODO bech32
// http request handler to query list of validators // http request handler to query list of validators
func validatorsHandlerFn(ctx context.CoreContext, storeName string, cdc *wire.Codec) http.HandlerFunc { func validatorsHandlerFn(ctx context.CoreContext, cdc *wire.Codec) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
kvs, err := ctx.QuerySubspace(cdc, stake.ValidatorsKey, storeName) kvs, err := ctx.QuerySubspace(cdc, stake.ValidatorsKey, storeName)
if err != nil { if err != nil {

View File

@ -162,6 +162,7 @@ func TestAddr(addr string, bech string) sdk.Address {
return res return res
} }
// nolint: unparam
func createTestAddrs(numAddrs int) []sdk.Address { func createTestAddrs(numAddrs int) []sdk.Address {
var addresses []sdk.Address var addresses []sdk.Address
var buffer bytes.Buffer var buffer bytes.Buffer
@ -180,6 +181,7 @@ func createTestAddrs(numAddrs int) []sdk.Address {
return addresses return addresses
} }
// nolint: unparam
func createTestPubKeys(numPubKeys int) []crypto.PubKey { func createTestPubKeys(numPubKeys int) []crypto.PubKey {
var publicKeys []crypto.PubKey var publicKeys []crypto.PubKey
var buffer bytes.Buffer var buffer bytes.Buffer

View File

@ -247,7 +247,7 @@ func (k Keeper) UpdateValidator(ctx sdk.Context, validator types.Validator) type
// efficiency case: // efficiency case:
// if already bonded and power increasing only need to update tendermint // if already bonded and power increasing only need to update tendermint
if powerIncreasing && !validator.Revoked && oldValidator.Status() == sdk.Bonded { if powerIncreasing && !validator.Revoked && oldValidator.Status() == sdk.Bonded {
bz := k.cdc.MustMarshalBinary(validator.ABCIValidator(k.cdc)) bz := k.cdc.MustMarshalBinary(validator.ABCIValidator())
store.Set(GetTendermintUpdatesKey(ownerAddr), bz) store.Set(GetTendermintUpdatesKey(ownerAddr), bz)
return validator return validator
} }
@ -445,7 +445,7 @@ func (k Keeper) unbondValidator(ctx sdk.Context, validator types.Validator) type
store.Set(GetValidatorKey(validator.Owner), bzVal) store.Set(GetValidatorKey(validator.Owner), bzVal)
// add to accumulated changes for tendermint // add to accumulated changes for tendermint
bzABCI := k.cdc.MustMarshalBinary(validator.ABCIValidatorZero(k.cdc)) bzABCI := k.cdc.MustMarshalBinary(validator.ABCIValidatorZero())
store.Set(GetTendermintUpdatesKey(validator.Owner), bzABCI) store.Set(GetTendermintUpdatesKey(validator.Owner), bzABCI)
// also remove from the Bonded types.Validators Store // also remove from the Bonded types.Validators Store
@ -474,7 +474,7 @@ func (k Keeper) bondValidator(ctx sdk.Context, validator types.Validator) types.
store.Set(GetValidatorsBondedIndexKey(validator.Owner), validator.Owner) store.Set(GetValidatorsBondedIndexKey(validator.Owner), validator.Owner)
// add to accumulated changes for tendermint // add to accumulated changes for tendermint
bzABCI := k.cdc.MustMarshalBinary(validator.ABCIValidator(k.cdc)) bzABCI := k.cdc.MustMarshalBinary(validator.ABCIValidator())
store.Set(GetTendermintUpdatesKey(validator.Owner), bzABCI) store.Set(GetTendermintUpdatesKey(validator.Owner), bzABCI)
return validator return validator
@ -503,7 +503,7 @@ func (k Keeper) RemoveValidator(ctx sdk.Context, address sdk.Address) {
} }
store.Delete(GetValidatorsBondedIndexKey(validator.Owner)) store.Delete(GetValidatorsBondedIndexKey(validator.Owner))
bz := k.cdc.MustMarshalBinary(validator.ABCIValidatorZero(k.cdc)) bz := k.cdc.MustMarshalBinary(validator.ABCIValidatorZero())
store.Set(GetTendermintUpdatesKey(address), bz) store.Set(GetTendermintUpdatesKey(address), bz)
} }

View File

@ -46,7 +46,7 @@ func TestSetValidator(t *testing.T) {
updates := keeper.GetTendermintUpdates(ctx) updates := keeper.GetTendermintUpdates(ctx)
require.Equal(t, 1, len(updates)) require.Equal(t, 1, len(updates))
assert.Equal(t, validator.ABCIValidator(keeper.cdc), updates[0]) assert.Equal(t, validator.ABCIValidator(), updates[0])
} }
@ -494,8 +494,8 @@ func TestGetTendermintUpdatesAllNone(t *testing.T) {
updates := keeper.GetTendermintUpdates(ctx) updates := keeper.GetTendermintUpdates(ctx)
require.Equal(t, 2, len(updates)) require.Equal(t, 2, len(updates))
assert.Equal(t, validators[0].ABCIValidator(keeper.cdc), updates[0]) assert.Equal(t, validators[0].ABCIValidator(), updates[0])
assert.Equal(t, validators[1].ABCIValidator(keeper.cdc), updates[1]) assert.Equal(t, validators[1].ABCIValidator(), updates[1])
// test from something to nothing // test from something to nothing
// tendermintUpdate set: {} -> {c1, c2, c3, c4} // tendermintUpdate set: {} -> {c1, c2, c3, c4}
@ -560,7 +560,7 @@ func TestGetTendermintUpdatesSingleValueChange(t *testing.T) {
updates := keeper.GetTendermintUpdates(ctx) updates := keeper.GetTendermintUpdates(ctx)
require.Equal(t, 1, len(updates)) require.Equal(t, 1, len(updates))
assert.Equal(t, validators[0].ABCIValidator(keeper.cdc), updates[0]) assert.Equal(t, validators[0].ABCIValidator(), updates[0])
} }
func TestGetTendermintUpdatesMultipleValueChange(t *testing.T) { func TestGetTendermintUpdatesMultipleValueChange(t *testing.T) {
@ -590,8 +590,8 @@ func TestGetTendermintUpdatesMultipleValueChange(t *testing.T) {
updates := keeper.GetTendermintUpdates(ctx) updates := keeper.GetTendermintUpdates(ctx)
require.Equal(t, 2, len(updates)) require.Equal(t, 2, len(updates))
require.Equal(t, validators[0].ABCIValidator(keeper.cdc), updates[0]) require.Equal(t, validators[0].ABCIValidator(), updates[0])
require.Equal(t, validators[1].ABCIValidator(keeper.cdc), updates[1]) require.Equal(t, validators[1].ABCIValidator(), updates[1])
} }
func TestGetTendermintUpdatesInserted(t *testing.T) { func TestGetTendermintUpdatesInserted(t *testing.T) {
@ -615,7 +615,7 @@ func TestGetTendermintUpdatesInserted(t *testing.T) {
validators[2] = keeper.UpdateValidator(ctx, validators[2]) validators[2] = keeper.UpdateValidator(ctx, validators[2])
updates := keeper.GetTendermintUpdates(ctx) updates := keeper.GetTendermintUpdates(ctx)
require.Equal(t, 1, len(updates)) require.Equal(t, 1, len(updates))
require.Equal(t, validators[2].ABCIValidator(keeper.cdc), updates[0]) require.Equal(t, validators[2].ABCIValidator(), updates[0])
// test validtor added at the beginning // test validtor added at the beginning
// tendermintUpdate set: {} -> {c0} // tendermintUpdate set: {} -> {c0}
@ -623,7 +623,7 @@ func TestGetTendermintUpdatesInserted(t *testing.T) {
validators[3] = keeper.UpdateValidator(ctx, validators[3]) validators[3] = keeper.UpdateValidator(ctx, validators[3])
updates = keeper.GetTendermintUpdates(ctx) updates = keeper.GetTendermintUpdates(ctx)
require.Equal(t, 1, len(updates)) require.Equal(t, 1, len(updates))
require.Equal(t, validators[3].ABCIValidator(keeper.cdc), updates[0]) require.Equal(t, validators[3].ABCIValidator(), updates[0])
// test validtor added at the end // test validtor added at the end
// tendermintUpdate set: {} -> {c0} // tendermintUpdate set: {} -> {c0}
@ -631,7 +631,7 @@ func TestGetTendermintUpdatesInserted(t *testing.T) {
validators[4] = keeper.UpdateValidator(ctx, validators[4]) validators[4] = keeper.UpdateValidator(ctx, validators[4])
updates = keeper.GetTendermintUpdates(ctx) updates = keeper.GetTendermintUpdates(ctx)
require.Equal(t, 1, len(updates)) require.Equal(t, 1, len(updates))
require.Equal(t, validators[4].ABCIValidator(keeper.cdc), updates[0]) require.Equal(t, validators[4].ABCIValidator(), updates[0])
} }
func TestGetTendermintUpdatesNotValidatorCliff(t *testing.T) { func TestGetTendermintUpdatesNotValidatorCliff(t *testing.T) {
@ -671,6 +671,6 @@ func TestGetTendermintUpdatesNotValidatorCliff(t *testing.T) {
updates = keeper.GetTendermintUpdates(ctx) updates = keeper.GetTendermintUpdates(ctx)
require.Equal(t, 2, len(updates), "%v", updates) require.Equal(t, 2, len(updates), "%v", updates)
require.Equal(t, validators[0].ABCIValidatorZero(keeper.cdc), updates[0]) require.Equal(t, validators[0].ABCIValidatorZero(), updates[0])
require.Equal(t, validators[2].ABCIValidator(keeper.cdc), updates[1]) require.Equal(t, validators[2].ABCIValidator(), updates[1])
} }

View File

@ -31,6 +31,7 @@ var (
type Operation func(r *rand.Rand, pool Pool, c Validator) (Pool, Validator, int64, string) type Operation func(r *rand.Rand, pool Pool, c Validator) (Pool, Validator, int64, string)
// operation: bond or unbond a validator depending on current status // operation: bond or unbond a validator depending on current status
// nolint: unparam
func OpBondOrUnbond(r *rand.Rand, pool Pool, val Validator) (Pool, Validator, int64, string) { func OpBondOrUnbond(r *rand.Rand, pool Pool, val Validator) (Pool, Validator, int64, string) {
var msg string var msg string
var newStatus sdk.BondStatus var newStatus sdk.BondStatus
@ -89,6 +90,7 @@ func RandomOperation(r *rand.Rand) Operation {
} }
// ensure invariants that should always be true are true // ensure invariants that should always be true are true
// nolint: unparam
func AssertInvariants(t *testing.T, msg string, func AssertInvariants(t *testing.T, msg string,
pOrig Pool, cOrig []Validator, pMod Pool, vMods []Validator, tokens int64) { pOrig Pool, cOrig []Validator, pMod Pool, vMods []Validator, tokens int64) {
@ -161,6 +163,7 @@ func AssertInvariants(t *testing.T, msg string,
// TODO refactor this random setup // TODO refactor this random setup
// generate a random validator // generate a random validator
// nolint: unparam
func randomValidator(r *rand.Rand, i int) Validator { func randomValidator(r *rand.Rand, i int) Validator {
poolSharesAmt := sdk.NewRat(int64(r.Int31n(10000))) poolSharesAmt := sdk.NewRat(int64(r.Int31n(10000)))

View File

@ -9,7 +9,6 @@ import (
tmtypes "github.com/tendermint/tendermint/types" tmtypes "github.com/tendermint/tendermint/types"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/wire"
) )
// Validator defines the total amount of bond shares and their exchange rate to // Validator defines the total amount of bond shares and their exchange rate to
@ -135,7 +134,7 @@ func (d Description) EnsureLength() (Description, sdk.Error) {
} }
// abci validator from stake validator type // abci validator from stake validator type
func (v Validator) ABCIValidator(cdc *wire.Codec) abci.Validator { func (v Validator) ABCIValidator() abci.Validator {
return abci.Validator{ return abci.Validator{
PubKey: tmtypes.TM2PB.PubKey(v.PubKey), PubKey: tmtypes.TM2PB.PubKey(v.PubKey),
Power: v.PoolShares.Bonded().Evaluate(), Power: v.PoolShares.Bonded().Evaluate(),
@ -144,7 +143,7 @@ func (v Validator) ABCIValidator(cdc *wire.Codec) abci.Validator {
// abci validator from stake validator type // abci validator from stake validator type
// with zero power used for validator updates // with zero power used for validator updates
func (v Validator) ABCIValidatorZero(cdc *wire.Codec) abci.Validator { func (v Validator) ABCIValidatorZero() abci.Validator {
return abci.Validator{ return abci.Validator{
PubKey: tmtypes.TM2PB.PubKey(v.PubKey), PubKey: tmtypes.TM2PB.PubKey(v.PubKey),
Power: 0, Power: 0,