Skip to content

Commit

Permalink
fix(x/simulation): finalize block after operations
Browse files Browse the repository at this point in the history
  • Loading branch information
ziscky committed Jan 14, 2025
1 parent d2aa3c2 commit 16651d6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions x/simulation/simulate.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,6 @@ func SimulateFromSeedX(
// Run the BeginBlock handler
logWriter.AddEntry(BeginBlockEntry(blockTime, blockHeight))

res, err := app.FinalizeBlock(finalizeBlockReq)
if err != nil {
return params, accs, fmt.Errorf("block finalization failed at height %d: %w", blockHeight, err)
}

ctx := app.NewContextLegacy(false, cmtproto.Header{
Height: blockHeight,
Time: blockTime,
Expand Down Expand Up @@ -260,6 +255,11 @@ func SimulateFromSeedX(
break
}

res, err := app.FinalizeBlock(finalizeBlockReq)
if err != nil {
return params, accs, fmt.Errorf("block finalization failed at height %d: %w", blockHeight, err)
}

// Generate a random RequestBeginBlock with the current validator set
// for the next block
finalizeBlockReq = RandomRequestFinalizeBlock(r, params, validators, pastTimes, pastVoteInfos, eventStats.Tally, blockHeight, blockTime, proposerAddress)
Expand All @@ -278,6 +278,7 @@ func SimulateFromSeedX(
exportedParams = params
}
}

logger.Info("Simulation complete", "height", blockHeight, "block-time", blockTime, "opsCount", opCount,
"run-time", time.Since(startTime), "app-hash", hex.EncodeToString(app.LastCommitID().Hash))

Expand Down

0 comments on commit 16651d6

Please sign in to comment.