From 2263cea118d4983a30f36c962603130f69ee72b6 Mon Sep 17 00:00:00 2001 From: Dev Ojha Date: Sun, 16 Sep 2018 21:15:06 -0700 Subject: [PATCH] Merge PR #2345: update doc.go for mock/simulation --- x/mock/doc.go | 13 +------------ x/mock/simulation/doc.go | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 x/mock/simulation/doc.go diff --git a/x/mock/doc.go b/x/mock/doc.go index d23aac3936..139cd87a5e 100644 --- a/x/mock/doc.go +++ b/x/mock/doc.go @@ -1,15 +1,4 @@ /* -Package mock provides functions for creating applications for testing. - -This module also features randomized testing, so that various modules can test -that their operations are interoperable. - -The intended method of using this randomized testing framework is that every -module provides TestAndRunTx methods for each of its desired methods of fuzzing -its own txs, and it also provides the invariants that it assumes to be true. -You then pick and choose from these tx types and invariants. To pick and choose -these, you first build a mock app with the correct keepers. Then you call the -app.RandomizedTesting method with the set of desired txs, invariants, along -with the setups each module requires. +Package mock provides utility methods to ease writing tests. */ package mock diff --git a/x/mock/simulation/doc.go b/x/mock/simulation/doc.go new file mode 100644 index 0000000000..8b9a3f6932 --- /dev/null +++ b/x/mock/simulation/doc.go @@ -0,0 +1,27 @@ +/* +Package simulation implements a simulation framework for any state machine +built on the SDK which utilizes auth. + +It is primarily intended for fuzz testing the integration of modules. +It will test that the provided operations are interoperable, +and that the desired invariants hold. +It can additionally be used to detect what the performance benchmarks in the +system are, by using benchmarking mode and cpu / mem profiling. +If it detects a failure, it provides the entire log of what was ran, + +The simulator takes as input: a random seed, the set of operations to run, +the invariants to test, and additional parameters to configure how long to run, +and misc. parameters that affect simulation speed. + +It is intended that every module provides a list of Operations which will randomly +create and run a message / tx in a manner that is interesting to fuzz, and verify that +the state transition was executed as expected. +Each module should additionally provide methods to assert that the desired invariants hold. + +Then to perform a randomized simulation, select the set of desired operations, +the weightings for each, the invariants you want to test, and how long to run it for. +Then run simulation.Simulate! +The simulator will handle things like ensuring that validators periodically double signing, +or go offline. +*/ +package simulation