diff --git a/docs/spec/emissions/messages.md b/docs/spec/emissions/messages.md index a93824c40a..b3549681bd 100644 --- a/docs/spec/emissions/messages.md +++ b/docs/spec/emissions/messages.md @@ -2,6 +2,9 @@ ## MsgUpdateParams +UpdateParams defines a governance operation for updating the x/emissions module parameters. +The authority is hard-coded to the x/gov module account. + ```proto message MsgUpdateParams { string authority = 1; diff --git a/x/emissions/keeper/msg_server_update_params.go b/x/emissions/keeper/msg_server_update_params.go index 137f37e754..9581a1b19f 100644 --- a/x/emissions/keeper/msg_server_update_params.go +++ b/x/emissions/keeper/msg_server_update_params.go @@ -9,6 +9,8 @@ import ( "github.com/zeta-chain/zetacore/x/emissions/types" ) +// UpdateParams defines a governance operation for updating the x/emissions module parameters. +// The authority is hard-coded to the x/gov module account. func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if msg.Authority != k.authority { return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) diff --git a/x/emissions/keeper/params.go b/x/emissions/keeper/params.go index c33c0c6317..2ba5a542a7 100644 --- a/x/emissions/keeper/params.go +++ b/x/emissions/keeper/params.go @@ -12,7 +12,11 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params, found bool) { if bz == nil { return types.Params{}, false } - k.cdc.MustUnmarshal(bz, ¶ms) + err := k.cdc.Unmarshal(bz, ¶ms) + if err != nil { + return types.Params{}, false + } + return params, true } @@ -23,7 +27,11 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { } store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal(¶ms) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.KeyPrefix(types.ParamsKey), bz) return nil }