Repository navigation
chore(bench): add state-read presets and gate - #9441
Conversation
👁️ Cyclops Security Review✅ Reviewed f957e98 (latest) · Coverage: partial ·
|
There was a problem hiding this comment.
Besides the inline findings, I checked whether the new pull_request trigger in bench-state-read-gate.yml could leak the bench secrets. It can't: the refs job skips PRs from forks, so the secret-bearing jobs that depend on it never run for them. The enforce and threshold-ms inputs reach the shell through env, not by being interpolated into the run script.
Extended reasoning...
This change adds a new CI workflow that passes cloud and telemetry secrets to a reusable bench workflow on pull_request events. It also adds txgen presets, a Solidity fixture and a Python gate script. The fork guard and the env-only input handling were checked and hold.
Findings marked 🟡 are optional suggestions and need no follow-up push.
There was a problem hiding this comment.
Code review found no new issues
No new issues were found in this update; 1 finding from earlier reviews is still open above.
1 optional suggestion (a nit or a note on pre-existing code) was found and not posted.
Still open from earlier reviews (1):
- 🔴
.github/workflows/bench-e2e-multi-region.yml:348—If tempo-multi-region-benchmark main does not yet accept these inputs, every state-read run, and every run whose baseli…
If you have decided not to act on one of these findings, resolve its thread (a reply alone leaves it open) and the next review stops counting it. To review this commit again now, use Re-run on its "Claude Code Review" check.
| # Skip empty blocks and the proposer's own (near-zero) insert of a block it built. | ||
| if gas < 9e6 or secs < 2e-3: | ||
| continue | ||
| if not any(a <= ts(when) <= b for a, b in windows): | ||
| continue | ||
| out.append((int(txs), gas, secs * 1000)) |
There was a problem hiding this comment.
Medium (trigger unconfirmed) · unverified: Underfilled blocks can pass the worst-case state-read gate
The worst-case benchmark is intended to validate blocks filled with state reads, but samples() accepts any block using at least 9M gas, and main() compares its unadjusted execution time with the 500ms threshold. The caller configures 500M-gas blocks while the dependent preset submits at one transaction per second and caps each transaction at 10M gas.
Full finding
The worst-case benchmark is intended to validate blocks filled with state reads, but samples() accepts any block using at least 9M gas, and main() compares its unadjusted execution time with the 500ms threshold. The caller configures 500M-gas blocks while the dependent preset submits at one transaction per second and caps each transaction at 10M gas. Consequently, a run containing only approximately single-transaction blocks can receive an enforced pass without testing the configured block-sized workload. Executed PoC: an in-memory unittest loaded the unmodified gate.py, mocked only file reads and glob discovery, supplied a valid feature window and 120 matching log entries of '2026-11-17T12:00:30Z INFO Block added to canonical chain txs=1 gas_used=10Mgas elapsed=100ms', and invoked main() with --enforce. It returned 0 and reported '120 | 10M | 100 ms | 100 ms' with result 'pass', although those blocks consume only 2% of the configured gas limit. This can falsely approve a gas-pricing check without establishing that full blocks execute within the threshold; it does not demonstrate a consensus vulnerability or a measured full-block slowdown. Actual cloud-run occupancy remains unverified. Pass the expected block gas budget into the gate, require sufficient near-full-block samples, and treat insufficient load as inconclusive or failed under enforcement. Adjust workload generation to achieve that occupancy rather than relying solely on a low fixed send rate.
Valid? React with 👍 / 👎.
| if len(rows) < args.min_blocks: | ||
| result, ok = f"inconclusive (< {args.min_blocks} blocks)", False | ||
| else: | ||
| ok = p99 <= args.threshold_ms | ||
| result = "pass" if ok else "over threshold" |
There was a problem hiding this comment.
Medium (trigger unconfirmed) · unverified: Repeated validator observations bypass the minimum-block requirement
The new guard promises that a run containing fewer than 30 loaded blocks is inconclusive, but main() compares min_blocks against the number of validator-log observations rather than distinct blocks. Each block can contribute one observation from every non-proposing validator.
Full finding
The new guard promises that a run containing fewer than 30 loaded blocks is inconclusive, but main() compares min_blocks against the number of validator-log observations rather than distinct blocks. Each block can contribute one observation from every non-proposing validator. For example, four distinct feature-phase blocks, each containing four transactions, consuming 40M gas and taking 50 ms on each of nine non-proposing validators, produce 36 accepted rows. The guard reports 36 blocks and passes under --enforce, despite only four block workloads having been exercised. Ten validators are the reusable workflow default, and the gate caller does not override that default or min_blocks. This defeats the newly introduced minimum workload-coverage safeguard and can label a short or partially loaded benchmark conclusive. An in-memory Node assertion test extracted the actual BLOCK regular expression and minimum default from gate.py, generated these ten-validator/four-block logs, and reproduced 36 accepted observations, a 50 ms projected p99, and a successful enforced decision. This was a source-derived reproduction, not native Python execution. The trigger requires artifacts containing repeated observations of fewer than 30 distinct loaded blocks; no actual cloud run demonstrating that condition was supplied. Retain block hash or height in samples and enforce the minimum on distinct block identities, or require the minimum separately per validator while retaining all observations for latency statistics. This root cause is the new observation-count guard, not the previously reported gas-occupancy threshold.
Valid? React with 👍 / 👎.
Adds
state-read-*benchmark presets (cold, hot, dependent, plus 45 GB / 16 GB node-memory variants) and theStateReaderfixture they call, and a manually dispatchedbench-state-read-gateworkflow that runsstate-read-coldandstate-read-dependenton the chosen ref.gate.pyreports p99 block execution time for the feature phase against a 500 ms threshold; report only unlessenforceis set.bench-e2e-multi-regiongains aresults-artifact-nameinput so one caller can run it more than once.