Skip to content

Commit

Permalink
fix: fix fuzzer test by using fauxMerkleModeOpt
Browse files Browse the repository at this point in the history
fix: remove unused func to fix linter
  • Loading branch information
Lockwarr committed Feb 16, 2023
1 parent cb1c162 commit d6dc19a
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/simapp/helpers"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/kv"
"github.com/cosmos/cosmos-sdk/types/module"
Expand Down Expand Up @@ -72,10 +71,6 @@ func fauxMerkleModeOpt(bapp *baseapp.BaseApp) {
bapp.SetFauxMerkleMode()
}

func interBlockCacheOpt() func(*baseapp.BaseApp) {
return baseapp.SetInterBlockCache(store.NewCommitKVStoreCacheManager())
}

func TestAppStateDeterminism(t *testing.T) {
if !simapp.FlagEnabledValue {
t.Skip("skipping application simulation")
Expand Down Expand Up @@ -121,7 +116,7 @@ func TestAppStateDeterminism(t *testing.T) {
}

db := tmdb.NewMemDB()
newApp := New(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, simapp.FlagPeriodValue, cosmoscmd.MakeEncodingConfig(ModuleBasics), simapp.EmptyAppOptions{}, interBlockCacheOpt())
newApp := New(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, simapp.FlagPeriodValue, cosmoscmd.MakeEncodingConfig(ModuleBasics), simapp.EmptyAppOptions{}, fauxMerkleModeOpt)
params.SetAddressPrefixes()
ctx := newApp.(*App).BaseApp.NewUncachedContext(true, tmproto.Header{})
newApp.(*App).TaxKeeper.SetParams(ctx, taxtypes.DefaultParams())
Expand Down Expand Up @@ -209,7 +204,7 @@ func TestAppImportExport(t *testing.T) {

t.Log("importing genesis...")

_, newDB, newDir, _, _, err := SetupSimulation("leveldb-app-sim-2", "Simulation-2")
_, newDB, newDir, _, _, err := simapp.SetupSimulation("leveldb-app-sim-2", "Simulation-2")
require.NoError(t, err, "simulation setup failed")

defer func() {
Expand Down Expand Up @@ -270,30 +265,6 @@ func TestAppImportExport(t *testing.T) {
}
}

// SetupSimulation wraps simapp.SetupSimulation in order to create any export directory if they do not exist yet
func SetupSimulation(dirPrefix, dbName string) (simtypes.Config, tmdb.DB, string, log.Logger, bool, error) {
config, db, dir, logger, skip, err := simapp.SetupSimulation(dirPrefix, dbName)
if err != nil {
return simtypes.Config{}, nil, "", nil, false, err
}

paths := []string{config.ExportParamsPath, config.ExportStatePath, config.ExportStatsPath}
for _, path := range paths {
if len(path) == 0 {
continue
}

path = filepath.Dir(path)
if _, err := os.Stat(path); os.IsNotExist(err) {
if err := os.MkdirAll(path, os.ModePerm); err != nil {
panic(err)
}
}
}

return config, db, dir, logger, skip, err
}

// GetSimulationLog unmarshals the KVPair's Value to the corresponding type based on the
// each's module store key and the prefix bytes of the KVPair's key.
func GetSimulationLog(storeName string, sdr sdk.StoreDecoderRegistry, kvAs, kvBs []kv.Pair) (log string) {
Expand Down

0 comments on commit d6dc19a

Please sign in to comment.