Currently, the SDK allows for custom account types; the `auth` keeper stores any type fulfilling its `Account` interface. However `auth` does not handle exporting or loading accounts to/from a genesis file, this is done by `genaccounts`, which only handles one of 4 concrete account types (`BaseAccount`, `ContinuousVestingAccount`, `DelayedVestingAccount` and `ModuleAccount`).
Projects desiring to use custom accounts (say custom vesting accounts) need to fork and modify `genaccounts`.
## Decision
In summary, we will (un)marshal all accounts (interface types) directly using amino, rather than converting to `genaccounts`’s `GenesisAccount` type. Since doing this removes the majority of `genaccounts`'s code, we will merge `genaccounts` into `auth`. Marshalled accounts will be stored in `auth`'s genesis state.
Detailed changes:
### 1) (Un)Marshal accounts directly using amino
The `auth` module's `GenesisState` gains a new field `Accounts`. Note these aren't of type `exported.Account` for reasons outlined in section 3.
```go
// GenesisState - all auth state that must be provided at genesis
return fmt.Errorf("duplicate account found in genesis state; address: %s", addrStr)
}
addrMap[addrStr] = true
// check account specific validation
if err := acc.Validate(); err != nil {
return fmt.Errorf("invalid account found in genesis state; address: %s, error: %s", addrStr, err.Error())
}
}
return nil
}
```
### 4) Move add-genesis-account cli to `auth`
The `genaccounts` module contains a cli command to add base or vesting accounts to a genesis file.
This will be moved to `auth`. We will leave it to projects to write their own commands to add custom accounts. An extensible cli handler, similar to `gov`, could be created but it is not worth the complexity for this minor use case.
### 5) Update module and vesting accounts
Under the new scheme, module and vesting account types need some minor updates:
- Type registration on `auth`'s codec (shown above)
- A `Validate` method for each `Account` concrete type
## Status
Proposed
## Consequences
### Positive
- custom accounts can be used without needing to fork `genaccounts`
- reduction in lines of code
### Negative
### Neutral
-`genaccounts` module no longer exists
- accounts in genesis files are stored under `accounts` in `auth` rather than in the `genaccounts` module.