Skip to content

Commit

Permalink
fix: proof module gRPC status error returns
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Nov 22, 2024
1 parent 59ec254 commit 9d98441
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions x/proof/keeper/msg_update_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,23 @@ package keeper
import (
"context"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/pokt-network/poktroll/x/proof/types"
)

func (k msgServer) UpdateParams(ctx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
if err := req.ValidateBasic(); err != nil {
return nil, err
return nil, status.Error(codes.InvalidArgument, err.Error())
}
if k.GetAuthority() != req.Authority {
return nil, types.ErrProofInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority)
return nil, status.Error(
codes.PermissionDenied,
types.ErrProofInvalidSigner.Wrapf(
"invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority,
).Error(),
)
}

if err := k.SetParams(ctx, req.Params); err != nil {
Expand Down

0 comments on commit 9d98441

Please sign in to comment.