fix(simulator): remove double-application of scaleFactor in targetCalls#184
Merged
Merged
Conversation
scaleFactor is applied per-tx inside sendTxs at line 608: expected = payloadParams.Mul(numCalls+1 * scaleFactor) meaning each tx already does scaleFactor times the base operations. targetCalls was then computed as: numCallsPerBlock * scaleFactor which multiplied scaleFactor in again — resulting in 5.71x more txs being targeted than actually needed (e.g. 572 instead of 100 for base-mainnet-simulation with GasLimit=200M, avg_gas_used=35M). Since the builder only absorbs ~100 txs/block worth of those scaled ops, pendingTxs accumulated beyond targetCalls after 2 blocks, causing callsToSend=0 forever and 7,000+ consecutive empty (deposit-only) blocks in a 900-block run. Fix: targetCalls = numCallsPerBlock (the tx count, not the ops count). scaleFactor belongs only in the per-tx operation calculation.
Collaborator
✅ Heimdall Review Status
|
refcell
approved these changes
May 15, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Root cause
scaleFactoris applied per-tx insidesendTxsto scale up the operations each transaction performs:So each tx already does
scaleFactor × payloadParamsoperations. Withavg_gas_used=35MandGasLimit=200M,scaleFactor≈5.71, so each tx does ~280 storage reads instead of the base 49.targetCallswas then computed as:This multiplied
scaleFactorin a second time at the tx-count level. The builder only absorbs ~100 txs/block (onenumCallsPerBlock's worth of gas). After 2 blockspendingTxsgrew past 572 andcallsToSend=0forever — producing empty (deposit-only) blocks for the rest of the run.Only affected workloads with both
avg_gas_usedand a numericcalls_per_blockset, which is onlybase-mainnet-simulationin the public configs. All other payloads leavescaleFactor=1.0so the double-application is a no-op.Observed: 7,000+ consecutive empty blocks in a 900-block
base-mainnet-simulationrun.Fix
scaleFactorbelongs only in the per-tx operation calculation (line 608).numCallsPerBlockis already the correct tx count — it is derived from gas estimation that already accounts for each tx doingscaleFactorworth of operations.