x/evm: move SetParams execution location in InitGenesis (#685)

* fix-init-evm-genesis-panic

* go fmt file
This commit is contained in:
Ray Green 2021-01-04 21:41:38 +08:00 committed by GitHub
parent d27810b6b5
commit 64ada18b01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,8 @@ import (
// InitGenesis initializes genesis state based on exported genesis // InitGenesis initializes genesis state based on exported genesis
func InitGenesis(ctx sdk.Context, k Keeper, accountKeeper types.AccountKeeper, data GenesisState) []abci.ValidatorUpdate { // nolint: interfacer func InitGenesis(ctx sdk.Context, k Keeper, accountKeeper types.AccountKeeper, data GenesisState) []abci.ValidatorUpdate { // nolint: interfacer
k.SetParams(ctx, data.Params)
evmDenom := data.Params.EvmDenom evmDenom := data.Params.EvmDenom
for _, account := range data.Accounts { for _, account := range data.Accounts {
@ -55,7 +57,6 @@ func InitGenesis(ctx sdk.Context, k Keeper, accountKeeper types.AccountKeeper, d
} }
k.SetChainConfig(ctx, data.ChainConfig) k.SetChainConfig(ctx, data.ChainConfig)
k.SetParams(ctx, data.Params)
// set state objects and code to store // set state objects and code to store
_, err = k.Commit(ctx, false) _, err = k.Commit(ctx, false)