diff --git a/cmd/gaia/app/app.go b/cmd/gaia/app/app.go index 5b1dbd672..d3692dce0 100644 --- a/cmd/gaia/app/app.go +++ b/cmd/gaia/app/app.go @@ -254,7 +254,7 @@ func (app *GaiaApp) ExportAppStateAndValidators() (appState json.RawMessage, val // Combined Staking Hooks type Hooks struct { dh distr.Hooks - sh slashing.ValidatorHooks + sh slashing.Hooks } func NewHooks(dh distr.Hooks, sh slashing.ValidatorHooks) Hooks { diff --git a/x/distribution/abci_app.go b/x/distribution/abci_app.go index 2ed9af0c0..648d70a5d 100644 --- a/x/distribution/abci_app.go +++ b/x/distribution/abci_app.go @@ -9,8 +9,8 @@ import ( // set the proposer for determining distribution during endblock func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) { - consAddr := sdk.ConsAddress{req.Header.Proposer.Address} - k.SetProposerConsAddr(consAddr) + consAddr := sdk.ConsAddress(req.Header.Proposer.Address) + k.SetProposerConsAddr(ctx, consAddr) } // allocate fees diff --git a/x/distribution/alias.go b/x/distribution/alias.go index 898a07714..920be5d3e 100644 --- a/x/distribution/alias.go +++ b/x/distribution/alias.go @@ -9,7 +9,9 @@ import ( ) type ( - Keeper = keeper.Keeper + Keeper = keeper.Keeper + Hooks = keeper.Hooks + DelegatorWithdrawInfo = types.DelegatorWithdrawInfo DelegatorDistInfo = types.DelegatorDistInfo ValidatorDistInfo = types.ValidatorDistInfo @@ -18,7 +20,7 @@ type ( MsgSetWithdrawAddress = types.MsgSetWithdrawAddress MsgWithdrawDelegatorRewardsAll = types.MsgWithdrawDelegatorRewardsAll - MsgWithdrawDelegationReward = types.MsgWithdrawDelegationReward + MsgWithdrawDelegatorReward = types.MsgWithdrawDelegatorReward MsgWithdrawValidatorRewardsAll = types.MsgWithdrawValidatorRewardsAll GenesisState = types.GenesisState @@ -47,7 +49,7 @@ var ( NewMsgSetWithdrawAddress = types.NewMsgSetWithdrawAddress NewMsgWithdrawDelegatorRewardsAll = types.NewMsgWithdrawDelegatorRewardsAll - NewMsgWithdrawDelegationReward = types.NewMsgWithdrawDelegationReward + NewMsgWithdrawDelegationReward = types.NewMsgWithdrawDelegatorReward NewMsgWithdrawValidatorRewardsAll = types.NewMsgWithdrawValidatorRewardsAll ) @@ -69,6 +71,6 @@ var ( ActionWithdrawValidatorRewardsAll = tags.ActionWithdrawValidatorRewardsAll TagAction = tags.Action - TagValidator = tags.SrcValidator + TagValidator = tags.Validator TagDelegator = tags.Delegator ) diff --git a/x/distribution/genesis.go b/x/distribution/genesis.go index 045c840ed..c7636c80c 100644 --- a/x/distribution/genesis.go +++ b/x/distribution/genesis.go @@ -2,7 +2,7 @@ package distribution import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/stake/types" + "github.com/cosmos/cosmos-sdk/x/distribution/types" ) // InitGenesis sets distribution information for genesis @@ -15,7 +15,7 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState) { for _, ddi := range data.DelegatorDistInfos { keeper.SetDelegatorDistInfo(ctx, ddi) } - for _, dw := range data.DelegatorWithdrawAddrs { + for _, dw := range data.DelegatorWithdrawInfos { keeper.SetDelegatorWithdrawAddr(ctx, dw.DelegatorAddr, dw.WithdrawAddr) } } @@ -32,6 +32,6 @@ func WriteGenesis(ctx sdk.Context, keeper Keeper) types.GenesisState { FeePool: feePool, ValidatorDistInfos: vdis, DelegatorDistInfos: ddis, - DelegatorWithdrawAddrs: dws, + DelegatorWithdrawInfos: dws, } } diff --git a/x/distribution/handler.go b/x/distribution/handler.go index 1ae74ac78..661d7d32a 100644 --- a/x/distribution/handler.go +++ b/x/distribution/handler.go @@ -11,7 +11,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { return func(ctx sdk.Context, msg sdk.Msg) sdk.Result { // NOTE msg already has validate basic run switch msg := msg.(type) { - case types.MsgModifyWithdrawAddress: + case types.MsgSetWithdrawAddress: return handleMsgModifyWithdrawAddress(ctx, msg, k) case types.MsgWithdrawDelegatorRewardsAll: return handleMsgWithdrawDelegatorRewardsAll(ctx, msg, k) @@ -30,9 +30,9 @@ func NewHandler(k keeper.Keeper) sdk.Handler { // These functions assume everything has been authenticated, // now we just perform action and save -func handleMsgModifyWithdrawAddress(ctx sdk.Context, msg types.MsgModifyWithdrawAddress, k keeper.Keeper) sdk.Result { +func handleMsgModifyWithdrawAddress(ctx sdk.Context, msg types.MsgSetWithdrawAddress, k keeper.Keeper) sdk.Result { - k.SetDelegatorWithdrawAddr(ctx, msg.DelegatorAddr, msg.WithdrawAddress) + k.SetDelegatorWithdrawAddr(ctx, msg.DelegatorAddr, msg.WithdrawAddr) tags := sdk.NewTags( tags.Action, tags.ActionModifyWithdrawAddress, diff --git a/x/distribution/types/msg.go b/x/distribution/types/msg.go index 6b4997fef..a98892ee9 100644 --- a/x/distribution/types/msg.go +++ b/x/distribution/types/msg.go @@ -62,7 +62,7 @@ type MsgWithdrawDelegatorRewardsAll struct { DelegatorAddr sdk.AccAddress `json:"delegator_addr"` } -func NewMsgWithdrawDelegationRewardsAll(delAddr sdk.AccAddress) MsgWithdrawDelegatorRewardsAll { +func NewMsgWithdrawDelegatorRewardsAll(delAddr sdk.AccAddress) MsgWithdrawDelegatorRewardsAll { return MsgWithdrawDelegatorRewardsAll{ DelegatorAddr: delAddr, } @@ -101,7 +101,7 @@ type MsgWithdrawDelegatorReward struct { ValidatorAddr sdk.ValAddress `json:"validator_addr"` } -func NewMsgWithdrawDelegationReward(delAddr sdk.AccAddress, valAddr sdk.ValAddress) MsgWithdrawDelegatorReward { +func NewMsgWithdrawDelegatorReward(delAddr sdk.AccAddress, valAddr sdk.ValAddress) MsgWithdrawDelegatorReward { return MsgWithdrawDelegatorReward{ DelegatorAddr: delAddr, ValidatorAddr: valAddr,