Skip to content

Commit

Permalink
move directory
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Oct 26, 2023
1 parent ba767d9 commit 2d3ba07
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
}
Expand Down
File renamed without changes.
9 changes: 4 additions & 5 deletions types/chain_id_test.go → x/genutil/types/chain_id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down
File renamed without changes.

0 comments on commit 2d3ba07

Please sign in to comment.