cronos
                                
                                 cronos copied to clipboard
                                
                                    cronos copied to clipboard
                            
                            
                            
                        create-vesting-account transaction doesn't work
Describe the bug
create-vesting-account transaction doesn't work.
To Reproduce
- Configure and start a new blockchain node (can be a local test node)
- Try to send a new create-vesting-accounttransaction
.\cronosd.exe tx vesting create-vesting-account ADDRESS AMOUNT TIME --home ... --from ... --chain-id ...
Transaction will fail with error:
raw_log: 'failed to execute message; message index: 0: invalid account type; expected:
  BaseAccount, got: *types.EthAccount: invalid request'
Expected behavior
The create-vesting-account should execute as expected and a new vesting account created
Screenshots

Desktop (please complete the following information):
- OS: Windows 10 21H2
Additional context
Cronos version used: 0.7.0 (https://github.com/crypto-org-chain/cronos/releases/tag/v0.7.0)
After a quick analysis I think this problem is happening because of a conflict between the Cronos and Cosmos code regarding the base account data structure.
In Crono's app.go we register a custom AccountI constructor function using ethermint.ProtoAccount.

Because of that every time the Cosmos's NewAccountWithAddress method is called an account of type EthAccount will be created instead of the default BaseAccount.
The problem is that Cosmos's CreateVestingAccount is not expecting that and when it invokes NewAccountWithAddress it tries to cast AccountI to BaseAccount.
The cast will fail and the transaction will not complete.

I'm not attaching logs because this an easy problem to replicate. I believe this is the problem but please double check my analysis.
Any questions please ask!
yeah, I think you are right here. But I believe you can implement vesting logic in an EVM smart contract?
There's a few advantages of using the native Cosmos's vesting accounts, for example:
- Even though they cannot transfer coins to another account the owner of the vesting account is able to delegate and undelegate from validators.
I could be wrong but I don't see a way to implement this mechanic via an EVM smart contract.
There's a few advantages of using the native Cosmos's vesting accounts, for example:
- Even though they cannot transfer coins to another account the owner of the vesting account is able to delegate and undelegate from validators.
I could be wrong but I don't see a way to implement this mechanic via an EVM smart contract.
I see, maybe we can make it work under ethermint.
it's fixed by upgrading to 0.46, and tested in https://github.com/crypto-org-chain/cronos/pull/648