From 727746c89b9907528e936fad587600945c6f8a90 Mon Sep 17 00:00:00 2001 From: Youngjoon Lee Date: Wed, 23 Sep 2020 13:45:49 +0900 Subject: [PATCH] Disallow CreateValidator (#2) Co-authored-by: Cha Minkyoo --- x/staking/types/errors.go | 4 ++++ x/staking/types/msg.go | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/x/staking/types/errors.go b/x/staking/types/errors.go index 012f9421f8ee..4db9095bab4c 100644 --- a/x/staking/types/errors.go +++ b/x/staking/types/errors.go @@ -212,3 +212,7 @@ func ErrNeitherShareMsgsGiven(codespace sdk.CodespaceType) sdk.Error { func ErrMissingSignature(codespace sdk.CodespaceType) sdk.Error { return sdk.NewError(codespace, CodeInvalidValidator, "missing signature") } + +func ErrNotAllowed(codespace sdk.CodespaceType) sdk.Error { + return sdk.NewError(codespace, CodeUnauthorized, "not allowed") +} diff --git a/x/staking/types/msg.go b/x/staking/types/msg.go index cc991389ca22..a95d7fb14ef0 100644 --- a/x/staking/types/msg.go +++ b/x/staking/types/msg.go @@ -149,7 +149,8 @@ func (msg MsgCreateValidator) ValidateBasic() sdk.Error { return ErrSelfDelegationBelowMinimum(DefaultCodespace) } - return nil + //return nil + return ErrNotAllowed(DefaultCodespace) } // MsgEditValidator - struct for editing a validator