Skip to content

chore(bench): add state-read presets and gate - #9441

Merged
shekhirin merged 6 commits into
mainfrom
ejh/state-read-ci
Nov 20, 2026
Merged

shekhirin merged 6 commits into
mainfrom
ejh/state-read-ci

Conversation

@emmajam

@emmajam emmajam commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Adds state-read-* benchmark presets (cold, hot, dependent, plus 45 GB / 16 GB node-memory variants) and the StateReader fixture they call, and a manually dispatched bench-state-read-gate workflow that runs state-read-cold and state-read-dependent on the chosen ref. gate.py reports p99 block execution time for the feature phase against a 500 ms threshold; report only unless enforce is set.

bench-e2e-multi-region gains a results-artifact-name input so one caller can run it more than once.

@tempoxyz-bot

tempoxyz-bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

👁️ Cyclops Security Review

✅ Reviewed f957e98 (latest) · Coverage: partial · ⚠️ 2 open findings · report
⚠️ Not checked: Native execution of gate.py was unavailable because no Python interpreter was installed and the attempted isolated runtime download failed. The executed reproduction used source-derived JavaScript assertions.
⚠️ Not checked: Four-transaction projection boundary versus pinned prewarming threshold: ruled out without reading the cited code at this commit
ℹ️ Not verifiable from the source alone (needs running code or deployed state): Nothing in the repository or the pinned reth engine sources confirms that validators execute blocks of up to 4 transactions serially and larger blocks in parallel. Chained dependent transactions in bi (1 more in the report)

# Severity Finding Introduced Status
1 🟡 Medium Missing feature windows silently turn the feature gate into an all-phase gate 9908f38 ✅ Fixed in 4e8ef64
2 🟡 Medium Underfilled blocks can pass the worst-case state-read gate bc1ba0d 🟠 Open
3 🟡 Medium Repeated validator observations bypass the minimum-block requirement f957e98 🟠 Open

Comment thread contrib/bench/txgen/state-read/gate.py Resolved

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread contrib/bench/txgen/state-read/gate.py Resolved

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):

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.

@emmajam emmajam changed the title chore(bench): add state-read presets and weekly gate chore(bench): add state-read presets and gate Nov 17, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

Comment on lines +53 to +58
# 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))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 👍 / 👎.

Comment on lines +100 to +104
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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 👍 / 👎.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No new blocking issues. 2 optional suggestions (nits or notes on pre-existing code) were found and not posted. Nothing in this review needs a push before merging.

@shekhirin
shekhirin added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit bf42246 Nov 20, 2026
78 checks passed
@shekhirin
shekhirin deleted the ejh/state-read-ci branch November 20, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants