@@ -4,11 +4,9 @@ import (
44 "errors"
55 "io"
66 "os"
7- "path/filepath"
87
98 rosettaCmd "cosmossdk.io/tools/rosetta/cmd"
109
11- "github.com/spf13/cast"
1210 "github.com/spf13/cobra"
1311 "github.com/spf13/viper"
1412 tmcfg "github.com/tendermint/tendermint/config"
@@ -18,7 +16,6 @@ import (
1816 "cosmossdk.io/simapp"
1917 "cosmossdk.io/simapp/params"
2018
21- "github.com/cosmos/cosmos-sdk/baseapp"
2219 "github.com/cosmos/cosmos-sdk/client"
2320 "github.com/cosmos/cosmos-sdk/client/config"
2421 "github.com/cosmos/cosmos-sdk/client/debug"
@@ -29,12 +26,8 @@ import (
2926 "github.com/cosmos/cosmos-sdk/server"
3027 serverconfig "github.com/cosmos/cosmos-sdk/server/config"
3128 servertypes "github.com/cosmos/cosmos-sdk/server/types"
32- "github.com/cosmos/cosmos-sdk/store"
33- "github.com/cosmos/cosmos-sdk/store/snapshots"
34- snapshottypes "github.com/cosmos/cosmos-sdk/store/snapshots/types"
3529 simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
3630 sdk "github.com/cosmos/cosmos-sdk/types"
37- "github.com/cosmos/cosmos-sdk/types/mempool"
3831 authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
3932 "github.com/cosmos/cosmos-sdk/x/auth/types"
4033 banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
@@ -263,52 +256,13 @@ func newApp(
263256 traceStore io.Writer ,
264257 appOpts servertypes.AppOptions ,
265258) servertypes.Application {
266- var cache sdk.MultiStorePersistentCache
267259
268- if cast .ToBool (appOpts .Get (server .FlagInterBlockCache )) {
269- cache = store .NewCommitKVStoreCacheManager ()
270- }
271-
272- skipUpgradeHeights := make (map [int64 ]bool )
273- for _ , h := range cast .ToIntSlice (appOpts .Get (server .FlagUnsafeSkipUpgrades )) {
274- skipUpgradeHeights [int64 (h )] = true
275- }
276-
277- pruningOpts , err := server .GetPruningOptionsFromFlags (appOpts )
278- if err != nil {
279- panic (err )
280- }
281-
282- snapshotDir := filepath .Join (cast .ToString (appOpts .Get (flags .FlagHome )), "data" , "snapshots" )
283- snapshotDB , err := dbm .NewDB ("metadata" , server .GetAppDBBackend (appOpts ), snapshotDir )
284- if err != nil {
285- panic (err )
286- }
287- snapshotStore , err := snapshots .NewStore (snapshotDB , snapshotDir )
288- if err != nil {
289- panic (err )
290- }
291-
292- snapshotOptions := snapshottypes .NewSnapshotOptions (
293- cast .ToUint64 (appOpts .Get (server .FlagStateSyncSnapshotInterval )),
294- cast .ToUint32 (appOpts .Get (server .FlagStateSyncSnapshotKeepRecent )),
295- )
260+ baseappOptions := server .DefaultBaseappOptions (appOpts )
296261
297262 return simapp .NewSimApp (
298263 logger , db , traceStore , true ,
299264 appOpts ,
300- baseapp .SetPruning (pruningOpts ),
301- baseapp .SetMinGasPrices (cast .ToString (appOpts .Get (server .FlagMinGasPrices ))),
302- baseapp .SetHaltHeight (cast .ToUint64 (appOpts .Get (server .FlagHaltHeight ))),
303- baseapp .SetHaltTime (cast .ToUint64 (appOpts .Get (server .FlagHaltTime ))),
304- baseapp .SetMinRetainBlocks (cast .ToUint64 (appOpts .Get (server .FlagMinRetainBlocks ))),
305- baseapp .SetInterBlockCache (cache ),
306- baseapp .SetTrace (cast .ToBool (appOpts .Get (server .FlagTrace ))),
307- baseapp .SetIndexEvents (cast .ToStringSlice (appOpts .Get (server .FlagIndexEvents ))),
308- baseapp .SetSnapshot (snapshotStore , snapshotOptions ),
309- baseapp .SetIAVLCacheSize (cast .ToInt (appOpts .Get (server .FlagIAVLCacheSize ))),
310- baseapp .SetIAVLDisableFastNode (cast .ToBool (appOpts .Get (server .FlagDisableIAVLFastNode ))),
311- baseapp .SetMempool (mempool .NewSenderNonceMempool (mempool .SenderNonceMaxTxOpt (cast .ToInt (appOpts .Get (server .FlagMempoolMaxTxs ))))),
265+ baseappOptions ... ,
312266 )
313267}
314268
0 commit comments