-
Notifications
You must be signed in to change notification settings - Fork 4.2k
resume simulations at a given height #4791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
49378c3
resume simulations
fedekunze 162a3e6
address @alexanderbez comments
fedekunze 79706f2
Update simapp/sim_test.go
fedekunze c2d476d
merge master
fedekunze 6a68f95
Merge branch 'fedekunze/4490-pause-resume-sims' of https://github.com…
fedekunze File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # 4490 add `InitialBlockHeight` flag to resume a simulation from a given block |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,7 +37,8 @@ func init() { | |
| flag.IntVar(&exportParamsHeight, "ExportParamsHeight", 0, "height to which export the randomly generated params") | ||
| flag.StringVar(&exportStatePath, "ExportStatePath", "", "custom file path to save the exported app state JSON") | ||
| flag.Int64Var(&seed, "Seed", 42, "simulation random seed") | ||
| flag.IntVar(&numBlocks, "NumBlocks", 500, "number of blocks") | ||
| flag.IntVar(&initialBlockHeight, "InitialBlockHeight", 1, "initial block to start the simulation") | ||
| flag.IntVar(&numBlocks, "NumBlocks", 500, "number of blocks to run the current simulation, after which the simulation halts") | ||
| flag.IntVar(&blockSize, "BlockSize", 200, "operations per block") | ||
| flag.BoolVar(&enabled, "Enabled", false, "enable the simulation") | ||
| flag.BoolVar(&verbose, "Verbose", false, "verbose log output") | ||
|
|
@@ -50,16 +51,17 @@ func init() { | |
| } | ||
|
|
||
| // helper function for populating input for SimulateFromSeed | ||
| // TODO: clean up this function along with the simulation refactor | ||
| func getSimulateFromSeedInput(tb testing.TB, w io.Writer, app *SimApp) ( | ||
| testing.TB, io.Writer, *baseapp.BaseApp, simulation.AppStateFn, int64, | ||
| simulation.WeightedOperations, sdk.Invariants, int, int, int, | ||
| simulation.WeightedOperations, sdk.Invariants, int, int, int, int, | ||
|
||
| bool, bool, bool, bool, bool, map[string]bool) { | ||
|
|
||
| exportParams := exportParamsPath != "" | ||
|
|
||
| return tb, w, app.BaseApp, appStateFn, seed, | ||
| testAndRunTxs(app), invariants(app), | ||
| numBlocks, exportParamsHeight, blockSize, | ||
| initialBlockHeight, numBlocks, exportParamsHeight, blockSize, | ||
| exportParams, commit, lean, onOperation, allInvariants, app.ModuleAccountAddrs() | ||
| } | ||
|
|
||
|
|
@@ -705,7 +707,7 @@ func TestAppStateDeterminism(t *testing.T) { | |
| simulation.SimulateFromSeed( | ||
| t, os.Stdout, app.BaseApp, appStateFn, seed, | ||
| testAndRunTxs(app), []sdk.Invariant{}, | ||
| 50, 100, 0, | ||
| 1, 50, 100, 0, | ||
| false, true, false, false, false, app.ModuleAccountAddrs(), | ||
| ) | ||
| appHash := app.LastCommitID().Hash | ||
|
|
@@ -733,7 +735,7 @@ func BenchmarkInvariants(b *testing.B) { | |
| // 2. Run parameterized simulation (w/o invariants) | ||
| _, params, simErr := simulation.SimulateFromSeed( | ||
| b, ioutil.Discard, app.BaseApp, appStateFn, seed, testAndRunTxs(app), | ||
| []sdk.Invariant{}, numBlocks, exportParamsHeight, blockSize, | ||
| []sdk.Invariant{}, initialBlockHeight, numBlocks, exportParamsHeight, blockSize, | ||
| exportParams, commit, lean, onOperation, false, app.ModuleAccountAddrs(), | ||
| ) | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.