From 3e847e90f68e1e1b546c03ce35c945073711a7b7 Mon Sep 17 00:00:00 2001 From: Aidan Salzmann Date: Sun, 27 Aug 2023 15:36:59 -0400 Subject: [PATCH] add base account validation --- x/vesting/keeper/msg_server.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/x/vesting/keeper/msg_server.go b/x/vesting/keeper/msg_server.go index 25f914b..5d134e3 100644 --- a/x/vesting/keeper/msg_server.go +++ b/x/vesting/keeper/msg_server.go @@ -6,9 +6,10 @@ package keeper import ( "context" "fmt" - "github.com/evmos/vesting/x/vesting/types" "time" + "github.com/evmos/vesting/x/vesting/types" + "github.com/cosmos/cosmos-sdk/telemetry" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -52,6 +53,14 @@ func (k Keeper) CreateClawbackVestingAccount( ) } + // Verify the account is a BaseAccount + _, isBaseAcc := acc.(*authtypes.BaseAccount) + if !isBaseAcc { + return nil, errorsmod.Wrapf(errortypes.ErrInvalidRequest, + "%s is not a BaseAccount", msg.VestingAddress, + ) + } + // Check if existing account already is a clawback vesting account _, isClawback := acc.(*types.ClawbackVestingAccount) if isClawback {