MCPcopy Create free account
hub / github.com/akash-network/node / CheckExportSimulation

Function CheckExportSimulation

app/sim/sim_utils.go:78–103  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

76// CheckExportSimulation exports the app state and simulation parameters to JSON
77// if the export paths are defined.
78func 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.
106func PrintStats(db dbm.DB) {

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected