forked from cerc-io/laconicd-deprecated
57ed355c98
* (refactor): Added new MsgUpdateParams tx and generated new proto files * (refactor): Refactor for migration of x/params * (fix): Refactor to use single Params store key for easier more readable code * (fix): removed unused * (fix): add validation * (fix): fix linter * remove line * Added changes from code review * Apply changes from code review * (fix): Made ParamKey back to a string * Added CHANGELOG entry * Apply suggestions from code review Co-authored-by: Tomas Guerra <54514587+GAtom22@users.noreply.github.com> * (fix): remove HTTP endpoint exposure * Apply suggestions from code review Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * fix: Apply changes from code review and run linter * Update x/feemarket/keeper/params.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * Update x/feemarket/types/msg.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * tests: added tests for msg_server and msg * tests: add failing test for migration * Update x/feemarket/keeper/params.go Co-authored-by: Tomas Guerra <54514587+GAtom22@users.noreply.github.com> Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
28 lines
926 B
Go
28 lines
926 B
Go
package keeper
|
|
|
|
import (
|
|
"context"
|
|
|
|
errorsmod "cosmossdk.io/errors"
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
|
"github.com/evmos/ethermint/x/feemarket/types"
|
|
)
|
|
|
|
// UpdateParams implements the gRPC MsgServer interface. When an UpdateParams
|
|
// proposal passes, it updates the module parameters. The update can only be
|
|
// performed if the requested authority is the Cosmos SDK governance module
|
|
// account.
|
|
func (k *Keeper) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
|
|
if k.authority.String() != req.Authority {
|
|
return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority.String(), req.Authority)
|
|
}
|
|
|
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
|
if err := k.SetParams(ctx, req.Params); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &types.MsgUpdateParamsResponse{}, nil
|
|
}
|