@@ -36,6 +36,7 @@ func init() {
36
36
flag .StringVar (& exportParamsPath , "ExportParamsPath" , "" , "custom file path to save the exported params JSON" )
37
37
flag .IntVar (& exportParamsHeight , "ExportParamsHeight" , 0 , "height to which export the randomly generated params" )
38
38
flag .StringVar (& exportStatePath , "ExportStatePath" , "" , "custom file path to save the exported app state JSON" )
39
+ flag .StringVar (& exportStatsPath , "ExportStatsPath" , "" , "custom file path to save the exported simulation statistics JSON" )
39
40
flag .Int64Var (& seed , "Seed" , 42 , "simulation random seed" )
40
41
flag .IntVar (& numBlocks , "NumBlocks" , 500 , "number of blocks" )
41
42
flag .IntVar (& blockSize , "BlockSize" , 200 , "operations per block" )
@@ -52,15 +53,15 @@ func init() {
52
53
// helper function for populating input for SimulateFromSeed
53
54
func getSimulateFromSeedInput (tb testing.TB , w io.Writer , app * SimApp ) (
54
55
testing.TB , io.Writer , * baseapp.BaseApp , simulation.AppStateFn , int64 ,
55
- simulation.WeightedOperations , sdk.Invariants , int , int , int ,
56
+ simulation.WeightedOperations , sdk.Invariants , int , int , int , string ,
56
57
bool , bool , bool , bool , bool , map [string ]bool ) {
57
58
58
59
exportParams := exportParamsPath != ""
59
60
60
61
return tb , w , app .BaseApp , appStateFn , seed ,
61
62
testAndRunTxs (app ), invariants (app ),
62
63
numBlocks , exportParamsHeight , blockSize ,
63
- exportParams , commit , lean , onOperation , allInvariants , app .ModuleAccountAddrs ()
64
+ exportStatsPath , exportParams , commit , lean , onOperation , allInvariants , app .ModuleAccountAddrs ()
64
65
}
65
66
66
67
func appStateFn (
@@ -412,7 +413,7 @@ func BenchmarkFullAppSimulation(b *testing.B) {
412
413
}
413
414
414
415
if commit {
415
- fmt .Println ("GoLevelDB Stats" )
416
+ fmt .Println ("\n GoLevelDB Stats" )
416
417
fmt .Println (db .Stats ()["leveldb.stats" ])
417
418
fmt .Println ("GoLevelDB cached block size" , db .Stats ()["leveldb.cachedblock" ])
418
419
}
@@ -471,7 +472,7 @@ func TestFullAppSimulation(t *testing.T) {
471
472
if commit {
472
473
// for memdb:
473
474
// fmt.Println("Database Size", db.Stats()["database.size"])
474
- fmt .Println ("GoLevelDB Stats" )
475
+ fmt .Println ("\n GoLevelDB Stats" )
475
476
fmt .Println (db .Stats ()["leveldb.stats" ])
476
477
fmt .Println ("GoLevelDB cached block size" , db .Stats ()["leveldb.cachedblock" ])
477
478
}
@@ -528,7 +529,7 @@ func TestAppImportExport(t *testing.T) {
528
529
if commit {
529
530
// for memdb:
530
531
// fmt.Println("Database Size", db.Stats()["database.size"])
531
- fmt .Println ("GoLevelDB Stats" )
532
+ fmt .Println ("\n GoLevelDB Stats" )
532
533
fmt .Println (db .Stats ()["leveldb.stats" ])
533
534
fmt .Println ("GoLevelDB cached block size" , db .Stats ()["leveldb.cachedblock" ])
534
535
}
@@ -644,7 +645,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
644
645
if commit {
645
646
// for memdb:
646
647
// fmt.Println("Database Size", db.Stats()["database.size"])
647
- fmt .Println ("GoLevelDB Stats" )
648
+ fmt .Println ("\n GoLevelDB Stats" )
648
649
fmt .Println (db .Stats ()["leveldb.stats" ])
649
650
fmt .Println ("GoLevelDB cached block size" , db .Stats ()["leveldb.cachedblock" ])
650
651
}
@@ -705,7 +706,7 @@ func TestAppStateDeterminism(t *testing.T) {
705
706
simulation .SimulateFromSeed (
706
707
t , os .Stdout , app .BaseApp , appStateFn , seed ,
707
708
testAndRunTxs (app ), []sdk.Invariant {},
708
- 50 , 100 , 0 ,
709
+ 50 , 100 , 0 , "" ,
709
710
false , true , false , false , false , app .ModuleAccountAddrs (),
710
711
)
711
712
appHash := app .LastCommitID ().Hash
@@ -734,7 +735,7 @@ func BenchmarkInvariants(b *testing.B) {
734
735
_ , params , simErr := simulation .SimulateFromSeed (
735
736
b , ioutil .Discard , app .BaseApp , appStateFn , seed , testAndRunTxs (app ),
736
737
[]sdk.Invariant {}, numBlocks , exportParamsHeight , blockSize ,
737
- exportParams , commit , lean , onOperation , false , app .ModuleAccountAddrs (),
738
+ exportStatsPath , exportParams , commit , lean , onOperation , false , app .ModuleAccountAddrs (),
738
739
)
739
740
740
741
// export state and params before the simulation error is checked
0 commit comments