forked from cerc-io/laconicd-deprecated
57ed355c98
* (refactor): Added new MsgUpdateParams tx and generated new proto files * (refactor): Refactor for migration of x/params * (fix): Refactor to use single Params store key for easier more readable code * (fix): removed unused * (fix): add validation * (fix): fix linter * remove line * Added changes from code review * Apply changes from code review * (fix): Made ParamKey back to a string * Added CHANGELOG entry * Apply suggestions from code review Co-authored-by: Tomas Guerra <54514587+GAtom22@users.noreply.github.com> * (fix): remove HTTP endpoint exposure * Apply suggestions from code review Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * fix: Apply changes from code review and run linter * Update x/feemarket/keeper/params.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * Update x/feemarket/types/msg.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * tests: added tests for msg_server and msg * tests: add failing test for migration * Update x/feemarket/keeper/params.go Co-authored-by: Tomas Guerra <54514587+GAtom22@users.noreply.github.com> Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
40 lines
963 B
Go
40 lines
963 B
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/feemarket/migrations/v4/types"
|
|
"github.com/evmos/ethermint/x/feemarket/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.Params
|
|
)
|
|
|
|
legacySubspace.GetParamSetIfExists(ctx, ¶ms)
|
|
|
|
if err := params.Validate(); err != nil {
|
|
return err
|
|
}
|
|
|
|
bz, err := cdc.Marshal(¶ms)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
store.Set(types.ParamsKey, bz)
|
|
|
|
return nil
|
|
}
|