github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/genutil/client/legacy/v0_18/migrate_test.go (about)

     1  package v018
     2  
     3  import (
     4  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/codec"
     5  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/genutil"
     6  	v018evm "github.com/fibonacci-chain/fbc/x/evm/legacy/v0_18"
     7  	v018staking "github.com/fibonacci-chain/fbc/x/staking/legacy/v0_18"
     8  	"github.com/stretchr/testify/require"
     9  	"testing"
    10  )
    11  
    12  // TestMigrate tests v017
    13  func TestMigrate(t *testing.T) {
    14  	v016Codec := codec.New()
    15  	codec.RegisterCrypto(v016Codec)
    16  
    17  	v018Codec := codec.New()
    18  	codec.RegisterCrypto(v018Codec)
    19  
    20  	appState := genutil.AppMap{
    21  		"staking": []byte(`{"params":{"bond_denom":"fibo","epoch":252,"max_bonded_validators":21,"max_validators_to_add_shares":30,"min_delegation":"0.000100000000000000","min_self_delegation":"10000.000000000000000000","unbonding_time":"1209600000000000"}}`),
    22  		"evm":     []byte(`{"params":{"enable_call":true,"enable_create":true,"evm_denom":"fibo","extra_eips":null}}`),
    23  	}
    24  	statsMigrate := Migrate(appState)
    25  
    26  	// stakingState
    27  	var stakingState v018staking.GenesisState
    28  	v018Codec.MustUnmarshalJSON(statsMigrate[v018staking.ModuleName], &stakingState)
    29  	require.NotNil(t, stakingState)
    30  
    31  	// evmState
    32  	var evmState v018evm.GenesisState
    33  	v018Codec.MustUnmarshalJSON(statsMigrate[v018evm.ModuleName], &evmState)
    34  	require.True(t, evmState.Params.EnableContractDeploymentWhitelist)
    35  	require.True(t, evmState.Params.EnableContractBlockedList)
    36  }