clawchain/x/messaging/keeper/msg_update_params.go
caelum0x cc12b2b899 feat: core chain updates — clawchain, governance, marketplace, tokenfactory, IBC, build
Updates across core modules, app wiring, IBC config, governance execution
tests, tokenfactory keeper/module, Makefile build targets, release CI,
and dependency updates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 22:14:09 +03:00

35 lines
914 B
Go

package keeper
import (
"context"
"clawchain/x/messaging/types"
errorsmod "cosmossdk.io/errors"
)
func (k msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
if _, err := k.addressCodec.StringToBytes(msg.Authority); err != nil {
return nil, errorsmod.Wrap(types.ErrInvalidSigner, "invalid authority address")
}
authorityAddr, err := k.addressCodec.BytesToString(k.GetAuthority())
if err != nil {
return nil, errorsmod.Wrap(types.ErrInvalidSigner, "invalid module authority")
}
if msg.Authority != authorityAddr {
return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "unauthorized: expected %s, got %s", authorityAddr, msg.Authority)
}
if err := msg.Params.Validate(); err != nil {
return nil, err
}
if err := k.Params.Set(ctx, msg.Params); err != nil {
return nil, err
}
return &types.MsgUpdateParamsResponse{}, nil
}