CheckExportSimulation exports the app state and simulation parameters to JSON if the export paths are defined.
(app runtime.AppI, config simtypes.Config, params simtypes.Params)
| 76 | // CheckExportSimulation exports the app state and simulation parameters to JSON |
| 77 | // if the export paths are defined. |
| 78 | func CheckExportSimulation(app runtime.AppI, config simtypes.Config, params simtypes.Params) error { |
| 79 | if config.ExportStatePath != "" { |
| 80 | fmt.Println("exporting app state...") |
| 81 | exported, err := app.ExportAppStateAndValidators(false, nil, nil) |
| 82 | if err != nil { |
| 83 | return err |
| 84 | } |
| 85 | |
| 86 | if err := os.WriteFile(config.ExportStatePath, []byte(exported.AppState), 0o600); err != nil { |
| 87 | return err |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | if config.ExportParamsPath != "" { |
| 92 | fmt.Println("exporting simulation params...") |
| 93 | paramsBz, err := json.MarshalIndent(params, "", " ") |
| 94 | if err != nil { |
| 95 | return err |
| 96 | } |
| 97 | |
| 98 | if err := os.WriteFile(config.ExportParamsPath, paramsBz, 0o600); err != nil { |
| 99 | return err |
| 100 | } |
| 101 | } |
| 102 | return nil |
| 103 | } |
| 104 | |
| 105 | // PrintStats prints the corresponding statistics from the app DB. |
| 106 | func PrintStats(db dbm.DB) { |
nothing calls this directly
no test coverage detected