Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
tests pt2
Browse files Browse the repository at this point in the history
  • Loading branch information
fedekunze committed Jan 23, 2023
1 parent 78c78a3 commit e684950
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions x/evm/migrations/v5/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"

"github.com/evmos/ethermint/app"
"github.com/evmos/ethermint/encoding"
Expand All @@ -31,13 +32,30 @@ func TestMigrate(t *testing.T) {
kvStore.Set(v5.ParamStoreKeyEVMDenom, []byte("aphoton"))
kvStore.Set(v5.ParamStoreKeyEnableCreate, []byte{0x01})
kvStore.Set(v5.ParamStoreKeyEnableCall, []byte{0x01})
kvStore.Set(v5.ParamStoreKeyAllowUnprotectedTxs, []byte{0x01})
kvStore.Set(v5.ParamStoreKeyExtraEIPs, extraEIPsBz)
kvStore.Set(v5.ParamStoreKeyChainConfig, chainConfigBz)

err := v5.MigrateStore(ctx, storeKey, cdc)
require.NoError(t, err)

paramsBz := kvStore.Get(types.KeyPrefixParams)
var params types.Params
cdc.MustUnmarshal(paramsBz, &params)

// TODO: test
// require.Equal(t, params, legacySubspace.ps)
// test that the params have been migrated correctly
require.Equal(t, "aphoton", params.EvmDenom)
require.True(t, params.EnableCreate)
require.True(t, params.EnableCall)
require.True(t, params.AllowUnprotectedTxs)
require.Equal(t, chainConfig, params.ChainConfig)
require.Equal(t, extraEIPs.EIPs, params.ExtraEIPs)

// check that the keys are deleted
require.False(t, kvStore.Has(v5.ParamStoreKeyEVMDenom))
require.False(t, kvStore.Has(v5.ParamStoreKeyEnableCreate))
require.False(t, kvStore.Has(v5.ParamStoreKeyEnableCall))
require.False(t, kvStore.Has(v5.ParamStoreKeyAllowUnprotectedTxs))
require.False(t, kvStore.Has(v5.ParamStoreKeyExtraEIPs))
require.False(t, kvStore.Has(v5.ParamStoreKeyChainConfig))
}

0 comments on commit e684950

Please sign in to comment.