@@ -73,11 +73,11 @@ func getSimulateFromSeedInput(tb testing.TB, w io.Writer, app *SimApp) (
7373 testing.TB , io.Writer , * baseapp.BaseApp , simulation.AppStateFn , int64 ,
7474 simulation.WeightedOperations , sdk.Invariants , int , int , bool , bool , bool ) {
7575
76- return tb , w , app .BaseApp , appStateFn , seed ,
76+ return tb , w , app .BaseApp , AppStateFn , seed ,
7777 testAndRunTxs (app ), invariants (app ), numBlocks , blockSize , commit , lean , onOperation
7878}
7979
80- func appStateFromGenesisFileFn (
80+ func AppStateFromGenesisFileFn (
8181 r * rand.Rand , _ []simulation.Account , _ time.Time ,
8282) (json.RawMessage , []simulation.Account , string ) {
8383
@@ -143,15 +143,15 @@ func appStateRandomizedFn(
143143` , amount , numInitiallyBonded ,
144144 )
145145
146- genGenesisAccounts (cdc , r , accs , genesisTimestamp , amount , numInitiallyBonded , genesisState )
147- genAuthGenesisState (cdc , r , appParams , genesisState )
148- genBankGenesisState (cdc , r , appParams , genesisState )
149- genSupplyGenesisState (cdc , amount , numInitiallyBonded , int64 (len (accs )), genesisState )
150- genGovGenesisState (cdc , r , appParams , genesisState )
151- genMintGenesisState (cdc , r , appParams , genesisState )
152- genDistrGenesisState (cdc , r , appParams , genesisState )
153- stakingGen := genStakingGenesisState (cdc , r , accs , amount , numAccs , numInitiallyBonded , appParams , genesisState )
154- genSlashingGenesisState (cdc , r , stakingGen , appParams , genesisState )
146+ GenGenesisAccounts (cdc , r , accs , genesisTimestamp , amount , numInitiallyBonded , genesisState )
147+ GenAuthGenesisState (cdc , r , appParams , genesisState )
148+ GenBankGenesisState (cdc , r , appParams , genesisState )
149+ GenSupplyGenesisState (cdc , amount , numInitiallyBonded , int64 (len (accs )), genesisState )
150+ GenGovGenesisState (cdc , r , appParams , genesisState )
151+ GenMintGenesisState (cdc , r , appParams , genesisState )
152+ GenDistrGenesisState (cdc , r , appParams , genesisState )
153+ stakingGen := GenStakingGenesisState (cdc , r , accs , amount , numAccs , numInitiallyBonded , appParams , genesisState )
154+ GenSlashingGenesisState (cdc , r , stakingGen , appParams , genesisState )
155155
156156 appState , err := MakeCodec ().MarshalJSON (genesisState )
157157 if err != nil {
@@ -161,7 +161,7 @@ func appStateRandomizedFn(
161161 return appState , accs , "simulation"
162162}
163163
164- func appStateFn (
164+ func AppStateFn (
165165 r * rand.Rand , accs []simulation.Account , genesisTimestamp time.Time ,
166166) (appState json.RawMessage , simAccs []simulation.Account , chainID string ) {
167167
@@ -172,7 +172,7 @@ func appStateFn(
172172 panic ("cannot provide both a genesis file and a params file" )
173173
174174 case genesisFile != "" :
175- appState , simAccs , chainID = appStateFromGenesisFileFn (r , accs , genesisTimestamp )
175+ appState , simAccs , chainID = AppStateFromGenesisFileFn (r , accs , genesisTimestamp )
176176
177177 case paramsFile != "" :
178178 appParams := make (simulation.AppParams )
@@ -192,7 +192,7 @@ func appStateFn(
192192 return appState , simAccs , chainID
193193}
194194
195- func genAuthGenesisState (cdc * codec.Codec , r * rand.Rand , ap simulation.AppParams , genesisState map [string ]json.RawMessage ) {
195+ func GenAuthGenesisState (cdc * codec.Codec , r * rand.Rand , ap simulation.AppParams , genesisState map [string ]json.RawMessage ) {
196196 authGenesis := auth .NewGenesisState (
197197 auth .NewParams (
198198 func (r * rand.Rand ) uint64 {
@@ -242,7 +242,7 @@ func genAuthGenesisState(cdc *codec.Codec, r *rand.Rand, ap simulation.AppParams
242242 genesisState [auth .ModuleName ] = cdc .MustMarshalJSON (authGenesis )
243243}
244244
245- func genBankGenesisState (cdc * codec.Codec , r * rand.Rand , ap simulation.AppParams , genesisState map [string ]json.RawMessage ) {
245+ func GenBankGenesisState (cdc * codec.Codec , r * rand.Rand , ap simulation.AppParams , genesisState map [string ]json.RawMessage ) {
246246 bankGenesis := bank .NewGenesisState (
247247 func (r * rand.Rand ) bool {
248248 var v bool
@@ -258,7 +258,7 @@ func genBankGenesisState(cdc *codec.Codec, r *rand.Rand, ap simulation.AppParams
258258 genesisState [bank .ModuleName ] = cdc .MustMarshalJSON (bankGenesis )
259259}
260260
261- func genSupplyGenesisState (cdc * codec.Codec , amount , numInitiallyBonded , numAccs int64 , genesisState map [string ]json.RawMessage ) {
261+ func GenSupplyGenesisState (cdc * codec.Codec , amount , numInitiallyBonded , numAccs int64 , genesisState map [string ]json.RawMessage ) {
262262 totalSupply := sdk .NewInt (amount * (numAccs + numInitiallyBonded ))
263263 supplyGenesis := supply .NewGenesisState (
264264 supply .NewSupply (sdk .NewCoins (sdk .NewCoin (sdk .DefaultBondDenom , totalSupply ))),
@@ -268,7 +268,7 @@ func genSupplyGenesisState(cdc *codec.Codec, amount, numInitiallyBonded, numAccs
268268 genesisState [supply .ModuleName ] = cdc .MustMarshalJSON (supplyGenesis )
269269}
270270
271- func genGenesisAccounts (
271+ func GenGenesisAccounts (
272272 cdc * codec.Codec , r * rand.Rand , accs []simulation.Account ,
273273 genesisTimestamp time.Time , amount , numInitiallyBonded int64 ,
274274 genesisState map [string ]json.RawMessage ,
@@ -326,7 +326,7 @@ func genGenesisAccounts(
326326 genesisState [genaccounts .ModuleName ] = cdc .MustMarshalJSON (genesisAccounts )
327327}
328328
329- func genGovGenesisState (cdc * codec.Codec , r * rand.Rand , ap simulation.AppParams , genesisState map [string ]json.RawMessage ) {
329+ func GenGovGenesisState (cdc * codec.Codec , r * rand.Rand , ap simulation.AppParams , genesisState map [string ]json.RawMessage ) {
330330 var vp time.Duration
331331 ap .GetOrGenerate (cdc , simulation .VotingParamsVotingPeriod , & vp , r ,
332332 func (r * rand.Rand ) {
@@ -379,7 +379,7 @@ func genGovGenesisState(cdc *codec.Codec, r *rand.Rand, ap simulation.AppParams,
379379 genesisState [gov .ModuleName ] = cdc .MustMarshalJSON (govGenesis )
380380}
381381
382- func genMintGenesisState (cdc * codec.Codec , r * rand.Rand , ap simulation.AppParams , genesisState map [string ]json.RawMessage ) {
382+ func GenMintGenesisState (cdc * codec.Codec , r * rand.Rand , ap simulation.AppParams , genesisState map [string ]json.RawMessage ) {
383383 mintGenesis := mint .NewGenesisState (
384384 mint .InitialMinter (
385385 func (r * rand.Rand ) sdk.Dec {
@@ -433,7 +433,7 @@ func genMintGenesisState(cdc *codec.Codec, r *rand.Rand, ap simulation.AppParams
433433 genesisState [mint .ModuleName ] = cdc .MustMarshalJSON (mintGenesis )
434434}
435435
436- func genDistrGenesisState (cdc * codec.Codec , r * rand.Rand , ap simulation.AppParams , genesisState map [string ]json.RawMessage ) {
436+ func GenDistrGenesisState (cdc * codec.Codec , r * rand.Rand , ap simulation.AppParams , genesisState map [string ]json.RawMessage ) {
437437 distrGenesis := distr.GenesisState {
438438 FeePool : distr .InitialFeePool (),
439439 CommunityTax : func (r * rand.Rand ) sdk.Dec {
@@ -466,7 +466,7 @@ func genDistrGenesisState(cdc *codec.Codec, r *rand.Rand, ap simulation.AppParam
466466 genesisState [distr .ModuleName ] = cdc .MustMarshalJSON (distrGenesis )
467467}
468468
469- func genSlashingGenesisState (
469+ func GenSlashingGenesisState (
470470 cdc * codec.Codec , r * rand.Rand , stakingGen staking.GenesisState ,
471471 ap simulation.AppParams , genesisState map [string ]json.RawMessage ,
472472) {
@@ -522,7 +522,7 @@ func genSlashingGenesisState(
522522 genesisState [slashing .ModuleName ] = cdc .MustMarshalJSON (slashingGenesis )
523523}
524524
525- func genStakingGenesisState (
525+ func GenStakingGenesisState (
526526 cdc * codec.Codec , r * rand.Rand , accs []simulation.Account , amount , numAccs , numInitiallyBonded int64 ,
527527 ap simulation.AppParams , genesisState map [string ]json.RawMessage ,
528528) staking.GenesisState {
@@ -944,7 +944,7 @@ func TestAppImportExport(t *testing.T) {
944944 storeB := ctxB .KVStore (storeKeyB )
945945 kvA , kvB , count , equal := sdk .DiffKVStores (storeA , storeB , prefixes )
946946 fmt .Printf ("Compared %d key/value pairs between %s and %s\n " , count , storeKeyA , storeKeyB )
947- require .True (t , equal , getSimulationLog (storeKeyA .Name (), app .cdc , newApp .cdc , kvA , kvB ))
947+ require .True (t , equal , GetSimulationLog (storeKeyA .Name (), app .cdc , newApp .cdc , kvA , kvB ))
948948 }
949949
950950}
@@ -1039,7 +1039,7 @@ func TestAppStateDeterminism(t *testing.T) {
10391039
10401040 // Run randomized simulation
10411041 simulation .SimulateFromSeed (
1042- t , os .Stdout , app .BaseApp , appStateFn , seed ,
1042+ t , os .Stdout , app .BaseApp , AppStateFn , seed ,
10431043 testAndRunTxs (app ),
10441044 []sdk.Invariant {},
10451045 50 ,
@@ -1071,7 +1071,7 @@ func BenchmarkInvariants(b *testing.B) {
10711071
10721072 // 2. Run parameterized simulation (w/o invariants)
10731073 _ , err := simulation .SimulateFromSeed (
1074- b , ioutil .Discard , app .BaseApp , appStateFn , seed , testAndRunTxs (app ),
1074+ b , ioutil .Discard , app .BaseApp , AppStateFn , seed , testAndRunTxs (app ),
10751075 []sdk.Invariant {}, numBlocks , blockSize , commit , lean , onOperation ,
10761076 )
10771077 if err != nil {
0 commit comments