From 5d28c46272fac3ade0d44f38d3cbb2f7a455b32f Mon Sep 17 00:00:00 2001 From: Julian Meyer Date: Mon, 1 Jun 2026 10:11:12 -0700 Subject: [PATCH] fix(simulator): bump pre-init buffer 1.05x -> 2.0x to fix CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The basic-benchmarks job in public-benchmarks.yaml has been failing on every push to main since cf47296 (PR #184, May 15) with: execution reverted: Not enough accounts to load/update Reproduces consistently for base-mainnet-simulation @ 25M gas (the first cell of the matrix, run on both reth and geth). Fails roughly 7-8 benchmark blocks into a 20-block run. Root mechanism: PR #184 changed targetCalls from ceil(numCallsPerBlock * scaleFactor) // pre-fix to numCallsPerBlock // post-fix to address an overshoot for scaleFactor > 1 (e.g. 200M gas case). For scaleFactor < 1 (small gas limits like 25M), this raised on-chain consumption within the existing 5% pre-init buffer. CI's base-mainnet-simulation @ 25M sits right at the boundary where rounding accumulation + per-field interaction overruns the 5% margin and trips the contract's current_address_index + load + update <= num_address_initialized require well before block 20. Bumping the multiplier to 2.0x removes the boundary entirely. Pre-init runs during setup (one-time cost, dominated by mineAndConfirm batching), so this adds maybe a few seconds of setup wall time per test cell — negligible vs the ~5 minutes per cell + 1h total job time. Out of scope for this PR but noted for follow-up: - OpcodeStats.Sub/Add iterate 'other' rather than the union of s and other, which causes per-tx blockCounts.Precompiles to always be empty in sendTxs. Result: per-tx actual gas is much lower than gas_per_call estimate, so the benchmark under-utilizes the gas budget. Not the cause of THIS CI failure, but should be fixed. - The contract require is a benchmark-fidelity check, not a protocol constraint; making the worker recalibrate numCallsPerBlock from observed on-chain consumption would be a more principled fix than relying on a static safety multiplier. --- runner/payload/simulator/worker.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runner/payload/simulator/worker.go b/runner/payload/simulator/worker.go index 1a228c7..edcaab1 100644 --- a/runner/payload/simulator/worker.go +++ b/runner/payload/simulator/worker.go @@ -389,7 +389,11 @@ func (t *simulatorPayloadWorker) testForBlocks(ctx context.Context, simulator *a t.log.Info("Calculated num calls per block", "numCalls", t.numCallsPerBlock, "gas", gas, "gasLimit", t.params.GasLimit, "buffer", buffer) - configForAllBlocks, err := t.payloadParams.Mul(float64(t.numCallsPerBlock) * float64(t.params.NumBlocks) * t.scaleFactor * 1.05).ToConfig() + // 2.0x safety multiplier (was 1.05). The 5% buffer was not enough to cover + // real on-chain consumption for base-mainnet-simulation @ 25M after PR #184, + // causing CI to revert with "Not enough accounts to load/update" mid-run. + // Pre-init is cheap relative to test runtime; err on the side of generous. + configForAllBlocks, err := t.payloadParams.Mul(float64(t.numCallsPerBlock) * float64(t.params.NumBlocks) * t.scaleFactor * 2.0).ToConfig() if err != nil { return errors.Wrap(err, "failed to convert payload params to config") }