diff --git a/server/util.go b/server/util.go index 905292f163a4..0c1a46a68688 100644 --- a/server/util.go +++ b/server/util.go @@ -37,6 +37,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/mempool" "github.com/cosmos/cosmos-sdk/version" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) // ServerContextKey defines the context key used to retrieve a server.Context from @@ -490,7 +491,7 @@ func DefaultBaseappOptions(appOpts types.AppOptions) []func(*baseapp.BaseApp) { } defer reader.Close() - chainID, err = sdk.ParseChainIDFromGenesis(reader) + chainID, err = genutiltypes.ParseChainIDFromGenesis(reader) if err != nil { panic(fmt.Errorf("failed to parse chain-id from genesis file: %w", err)) } diff --git a/types/chain_id.go b/x/genutil/types/chain_id.go similarity index 100% rename from types/chain_id.go rename to x/genutil/types/chain_id.go diff --git a/types/chain_id_test.go b/x/genutil/types/chain_id_test.go similarity index 87% rename from types/chain_id_test.go rename to x/genutil/types/chain_id_test.go index f37bf1b1dd7a..2f558a37d99b 100644 --- a/types/chain_id_test.go +++ b/x/genutil/types/chain_id_test.go @@ -7,8 +7,7 @@ import ( "github.com/stretchr/testify/require" - sdk "github.com/cosmos/cosmos-sdk/types" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/cosmos/cosmos-sdk/x/genutil/types" ) //go:embed testdata/parse_chain_id.json @@ -96,7 +95,7 @@ func TestParseChainIDFromGenesis(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - chain_id, err := sdk.ParseChainIDFromGenesis(strings.NewReader(tc.json)) + chain_id, err := types.ParseChainIDFromGenesis(strings.NewReader(tc.json)) if tc.expChainID == "" { require.Error(t, err) require.Contains(t, err.Error(), tc.expError) @@ -114,7 +113,7 @@ func BenchmarkParseChainID(b *testing.B) { b.Run("new", func(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { - chainId, err := sdk.ParseChainIDFromGenesis(strings.NewReader(BenchmarkGenesis)) + chainId, err := types.ParseChainIDFromGenesis(strings.NewReader(BenchmarkGenesis)) require.NoError(b, err) require.Equal(b, expChainID, chainId) } @@ -123,7 +122,7 @@ func BenchmarkParseChainID(b *testing.B) { b.Run("old", func(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { - doc, err := genutiltypes.AppGenesisFromReader(strings.NewReader(BenchmarkGenesis)) + doc, err := types.AppGenesisFromReader(strings.NewReader(BenchmarkGenesis)) require.NoError(b, err) require.Equal(b, expChainID, doc.ChainID) } diff --git a/types/testdata/parse_chain_id.json b/x/genutil/types/testdata/parse_chain_id.json similarity index 100% rename from types/testdata/parse_chain_id.json rename to x/genutil/types/testdata/parse_chain_id.json