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

Function CheckExportSimulation

testutil/sims/simulation_helpers.go:87–112  ·  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

85// CheckExportSimulation exports the app state and simulation parameters to JSON
86// if the export paths are defined.
87func CheckExportSimulation(app runtime.AppI, config simtypes.Config, params simtypes.Params) error {
88 if config.ExportStatePath != "" {
89 fmt.Println("exporting app state...")
90 exported, err := app.ExportAppStateAndValidators(false, nil, nil)
91 if err != nil {
92 return err
93 }
94
95 if err := os.WriteFile(config.ExportStatePath, []byte(exported.AppState), 0o600); err != nil {
96 return err
97 }
98 }
99
100 if config.ExportParamsPath != "" {
101 fmt.Println("exporting simulation params...")
102 paramsBz, err := json.MarshalIndent(params, "", " ")
103 if err != nil {
104 return err
105 }
106
107 if err := os.WriteFile(config.ExportParamsPath, paramsBz, 0o600); err != nil {
108 return err
109 }
110 }
111 return nil
112}
113
114// PrintStats prints the corresponding statistics from the app DB.
115func PrintStats(db dbm.DB) {

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected