Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
(cherry picked from commit b75bab14bb9bf529529d49bd78622e0e046171e5)
  • Loading branch information
alpe committed Sep 16, 2024
1 parent 0dca85b commit f367402
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion simsx/delivery.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type (
// The function returns a simtypes.OperationMsg, which is a legacy representation of the result
// of the delivery.
func DeliverSimsMsg(
ctx sdk.Context,
ctx context.Context,
reporter SimulationReporter,
app AppEntrypoint,
r *rand.Rand,
Expand Down
13 changes: 13 additions & 0 deletions simsx/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ var defaultSeeds = []int64{
977367484, 491163361, 424254581, 673398983,
}

// SimStateFactory is a factory type that provides a convenient way to create a simulation state for testing.
// It contains the following fields:
// - Codec: a codec used for serializing other objects
// - AppStateFn: a function that returns the app state JSON bytes and the genesis accounts
// - BlockedAddr: a map of blocked addresses
// - AccountSource: an interface for retrieving accounts
// - BalanceSource: an interface for retrieving balance-related information
type SimStateFactory struct {
Codec codec.Codec
AppStateFn simtypes.AppStateFn
Expand Down Expand Up @@ -117,6 +124,12 @@ func RunWithSeeds[T SimulationApp](
}
}

// RunWithSeed is a helper function that runs a simulation test with the given parameters.
// It iterates over the provided seeds and runs the simulation test for each seed in parallel.
//
// It sets up the environment, creates an instance of the simulation app,
// calls the simulation.SimulateFromSeed function to run the simulation, and performs post-run actions for the seed.
// The execution is deterministic and can be used for fuzz tests as well.
func RunWithSeed[T SimulationApp](
tb testing.TB,
cfg simtypes.Config,
Expand Down

0 comments on commit f367402

Please sign in to comment.