forked from cerc-io/laconicd-deprecated
0f7bdceaa0
* imp(evm): Migrate from old Cosmos SDK params module to new way of keeping params in module Keeper * Updated changelog * Apply changes from code review * (impv): Added Shanghai and Cancun blocks to current types and latest migration * (tests): Update unit tests to include Shanghai and Cancun blocks * (fix) - ran golangci-lint on the entire project * (fix) - remove deprecated params method * (impv): added marshaling of booleans per individual param key * (impv): added individual param getting and setting * (impv): replaced getters with individual param * (impv): added amino codec for MsgEthereumTx * Added changes suggested in code review * (fix): updated the migration files for v4 * (fix): fixed unit tests panic for incorrect interface * (fix): updated module msg handler * (fix): rename to original params getter method * (refactor): registered implementation for the new msg * (refactor): added correct amino codec for MsgUpdateParams and removed for MsgEthTx * Applied changes from code review * (fix): removed unnecessary duplicate * (fix): removed params_legacy from the types and moved logic to migration * (fix): Added v4 mocks to the migrations_test * (fix): undo all the non related work regarding the Cancun and Shanghai blocks * (fix): reverted linting the entire project - will make a separate PR for it * Applied changes from review * Applied changes from code review * (fix): removed comments * (fix): Ran formatter and fixed linting issues on unsed functions * (fix): Linting issues resolved * (fix): refactor migrations and added default EIPs * (fix): Combined into one call * (fix): Added more straightforward way to handle migration * (fix): corrected migration test * Applied changes from code review * (fix): Linter fix * (fix): Linter * (fix): Lint proto files * Apply suggestions from code review Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * (fix): Added new block to migration * (fix): Added additional comments and formatted proto files * (fix): Added name to unit test cases * (fix): removed unused import * Apply changes from code review * (fix): typo * (fix): remove HTTP endpoint exposure * Apply suggestions from code review Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * applied changes from code review * fix: extra line added in merge removed * fix: applied changes from code review Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
52 lines
1.4 KiB
Go
52 lines
1.4 KiB
Go
package v4
|
|
|
|
import (
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
v4types "github.com/evmos/ethermint/x/evm/migrations/v4/types"
|
|
"github.com/evmos/ethermint/x/evm/types"
|
|
)
|
|
|
|
// MigrateStore migrates the x/evm module state from the consensus version 3 to
|
|
// version 4. Specifically, it takes the parameters that are currently stored
|
|
// and managed by the Cosmos SDK params module and stores them directly into the x/evm module state.
|
|
func MigrateStore(
|
|
ctx sdk.Context,
|
|
storeKey storetypes.StoreKey,
|
|
legacySubspace types.Subspace,
|
|
cdc codec.BinaryCodec,
|
|
) error {
|
|
var (
|
|
store = ctx.KVStore(storeKey)
|
|
params v4types.V4Params
|
|
)
|
|
|
|
legacySubspace.GetParamSetIfExists(ctx, ¶ms)
|
|
|
|
if err := params.Validate(); err != nil {
|
|
return err
|
|
}
|
|
|
|
chainCfgBz := cdc.MustMarshal(¶ms.ChainConfig)
|
|
extraEIPsBz := cdc.MustMarshal(&v4types.ExtraEIPs{EIPs: v4types.AvailableExtraEIPs})
|
|
|
|
store.Set(v4types.ParamStoreKeyEVMDenom, []byte(params.EvmDenom))
|
|
store.Set(v4types.ParamStoreKeyExtraEIPs, extraEIPsBz)
|
|
store.Set(v4types.ParamStoreKeyChainConfig, chainCfgBz)
|
|
|
|
if params.AllowUnprotectedTxs {
|
|
store.Set(v4types.ParamStoreKeyAllowUnprotectedTxs, []byte{0x01})
|
|
}
|
|
|
|
if params.EnableCall {
|
|
store.Set(v4types.ParamStoreKeyEnableCall, []byte{0x01})
|
|
}
|
|
|
|
if params.EnableCreate {
|
|
store.Set(v4types.ParamStoreKeyEnableCreate, []byte{0x01})
|
|
}
|
|
|
|
return nil
|
|
}
|