Skip to content

Commit d3f7c70

Browse files
authored
Revert "fix: add base account getter (backport #12154) (#12161)"
This reverts commit 008d10d.
1 parent a3f8a83 commit d3f7c70

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ Ref: https://keepachangelog.com/en/1.0.0/
5151
* [\#10947](https://github.com/cosmos/cosmos-sdk/pull/10947) Add `AllowancesByGranter` query to the feegrant module
5252
* [\#9639](https://github.com/cosmos/cosmos-sdk/pull/9639) Check store keys length before accessing them by making sure that `key` is of length `m+1` (for `key[n:m]`)
5353
* [\#11983](https://github.com/cosmos/cosmos-sdk/pull/11983) (x/feegrant, x/authz) rename grants query commands to `grants-by-grantee`, `grants-by-granter` cmds.
54-
* (types) [#12154](https://github.com/cosmos/cosmos-sdk/pull/12154) Add `baseAccountGetter` to avoid invalid account error when create vesting account.
5554

5655
## Improvements
5756

x/auth/vesting/msg_server.go

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ type msgServer struct {
1919
types.BankKeeper
2020
}
2121

22-
type baseAccountGetter interface {
23-
GetBaseAccount() *authtypes.BaseAccount
24-
}
25-
2622
// NewMsgServerImpl returns an implementation of the vesting MsgServer interface,
2723
// wrapping the corresponding AccountKeeper and BankKeeper.
2824
func NewMsgServerImpl(k keeper.AccountKeeper, bk types.BankKeeper) types.MsgServer {
@@ -57,18 +53,12 @@ func (s msgServer) CreateVestingAccount(goCtx context.Context, msg *types.MsgCre
5753
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress)
5854
}
5955

60-
account := ak.NewAccountWithAddress(ctx, to)
61-
baseAccount, ok := account.(*authtypes.BaseAccount)
62-
if !ok {
63-
if getter, ok := account.(baseAccountGetter); ok {
64-
baseAccount = getter.GetBaseAccount()
65-
}
66-
}
67-
if baseAccount == nil {
56+
baseAccount := ak.NewAccountWithAddress(ctx, to)
57+
if _, ok := baseAccount.(*authtypes.BaseAccount); !ok {
6858
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid account type; expected: BaseAccount, got: %T", baseAccount)
6959
}
7060

71-
baseVestingAccount := types.NewBaseVestingAccount(baseAccount, msg.Amount.Sort(), msg.EndTime)
61+
baseVestingAccount := types.NewBaseVestingAccount(baseAccount.(*authtypes.BaseAccount), msg.Amount.Sort(), msg.EndTime)
7262

7363
var acc authtypes.AccountI
7464

0 commit comments

Comments
 (0)