diff --git a/server/v2/appmanager/appmanager.go b/server/v2/appmanager/appmanager.go index 35fe6cec515..eefae7667a7 100644 --- a/server/v2/appmanager/appmanager.go +++ b/server/v2/appmanager/appmanager.go @@ -213,12 +213,12 @@ func (a appManager[T]) DeliverSims( } if latestVersion+1 != block.Height { - return nil, nil, fmt.Errorf("invalid DeliverBlock height wanted %d, got %d", latestVersion+1, block.Height) + return nil, nil, fmt.Errorf("invalid DeliverSims height wanted %d, got %d", latestVersion+1, block.Height) } blockResponse, newState, err := a.stf.DeliverSims(ctx, block, currentState, simsBuilder) if err != nil { - return nil, nil, fmt.Errorf("block delivery failed: %w", err) + return nil, nil, fmt.Errorf("sims delivery failed: %w", err) } return blockResponse, newState, nil diff --git a/simapp/v2/sim_runner.go b/simapp/v2/sim_runner.go index f0515c6dfb0..3ae56ad7787 100644 --- a/simapp/v2/sim_runner.go +++ b/simapp/v2/sim_runner.go @@ -151,7 +151,11 @@ func SetupTestInstance[T Tx, V SimulationApp[T]](t *testing.T, factory AppFactor } // RunWithSeeds runs a series of subtests using the default set of random seeds for deterministic simulation testing. -func RunWithSeeds[T Tx](t *testing.T, seeds []int64) { +func RunWithSeeds[T Tx]( + t *testing.T, + seeds []int64, + postRunActions ...func(t testing.TB, app TestInstance[T], accs []simtypes.Account), +) { t.Helper() cfg := cli.NewConfigFromFlags() cfg.ChainID = SimAppChainID @@ -159,13 +163,20 @@ func RunWithSeeds[T Tx](t *testing.T, seeds []int64) { seed := seeds[i] t.Run(fmt.Sprintf("seed: %d", seed), func(t *testing.T) { t.Parallel() - RunWithSeed(t, NewSimApp[T], AppConfig(), cfg, seed) + RunWithSeed(t, NewSimApp[T], AppConfig(), cfg, seed, postRunActions...) }) } } // RunWithSeed initializes and executes a simulation run with the given seed, generating blocks and transactions. -func RunWithSeed[T Tx, V SimulationApp[T]](t *testing.T, appFactory AppFactory[T, V], appConfig depinject.Config, tCfg simtypes.Config, seed int64) { +func RunWithSeed[T Tx, V SimulationApp[T]]( + t *testing.T, + appFactory AppFactory[T, V], + appConfig depinject.Config, + tCfg simtypes.Config, + seed int64, + postRunActions ...func(t testing.TB, app TestInstance[T], accs []simtypes.Account), +) { t.Helper() r := rand.New(rand.NewSource(seed)) testInstance := SetupTestInstance[T, V](t, appFactory, appConfig) @@ -209,6 +220,10 @@ func RunWithSeed[T Tx, V SimulationApp[T]](t *testing.T, appFactory AppFactory[T testInstance.StakingKeeper, ) require.NoError(t, testInstance.App.Close(), "closing app") + + for _, step := range postRunActions { + step(t, testInstance, accounts) + } } // prepareInitialGenesisState initializes the genesis state for simulation by generating accounts, app state, chain ID, and timestamp.