From 9b9a9452ebbd513946b4d24a46ec7c122e24e073 Mon Sep 17 00:00:00 2001
From: Philip Offtermatt
Date: Fri, 26 Jul 2024 14:39:09 +0200
Subject: [PATCH] Make the simulator use a random seed
---
Makefile | 4 ++--
app/provider/sim_test.go | 5 ++++-
go.mod | 2 +-
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 1e8eb8e5bc..0b062432ab 100644
--- a/Makefile
+++ b/Makefile
@@ -151,12 +151,12 @@ verify-models:
# Run a full simulation test
sim-full:
cd app/provider;\
- go test -mod=readonly . -run=^TestFullAppSimulation$ -Enabled=true -NumBlocks=500 -BlockSize=200 -Commit=true -timeout 24h -v
+ go test -mod=readonly . -run=^TestFullAppSimulation$ -Enabled=true -NumBlocks=500 -BlockSize=200 -Commit=true -timeout 24h -v -Seed=$$RANDOM
# Run full simulation without any inactive validators
sim-full-no-inactive-vals:
cd app/provider;\
- go test -mod=readonly . -run=^TestFullAppSimulation$ -Enabled=true -NumBlocks=500 -BlockSize=200 -Commit=true -timeout 24h -Params=no_inactive_vals_params.json -v
+ go test -mod=readonly . -run=^TestFullAppSimulation$ -Enabled=true -NumBlocks=500 -BlockSize=200 -Commit=true -timeout 24h -Params=no_inactive_vals_params.json -Seed=$$RANDOM -v
###############################################################################
diff --git a/app/provider/sim_test.go b/app/provider/sim_test.go
index a6eea50c6c..538ec03c53 100644
--- a/app/provider/sim_test.go
+++ b/app/provider/sim_test.go
@@ -18,6 +18,8 @@ import (
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
providerapp "github.com/cosmos/interchain-security/v5/app/provider"
+
+ spew "github.com/davecgh/go-spew/spew"
)
func init() {
@@ -41,7 +43,8 @@ func TestFullAppSimulation(t *testing.T) {
config.ChainID = "provi"
fmt.Println("========================================")
- fmt.Println(config)
+ fmt.Println("Running with the configuration:")
+ fmt.Println(spew.Sdump(config))
fmt.Println("========================================")
db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue)
diff --git a/go.mod b/go.mod
index 5a7eaa9368..ef141ec799 100644
--- a/go.mod
+++ b/go.mod
@@ -70,7 +70,7 @@ require (
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
- github.com/gogo/protobuf v1.3.2 // indirect
+ github.com/gogo/protobuf v1.3.2
github.com/golang/glog v1.2.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect