Skip to content

scripts: consensus report data pipeline — load, index, extract votes and validation#13205

Open
lev-starkware wants to merge 1 commit intopr9-consensus-report-block-weightsfrom
pr10-consensus-report-data-pipeline
Open

scripts: consensus report data pipeline — load, index, extract votes and validation#13205
lev-starkware wants to merge 1 commit intopr9-consensus-report-block-weightsfrom
pr10-consensus-report-data-pipeline

Conversation

@lev-starkware
Copy link
Contributor

@lev-starkware lev-starkware commented Mar 11, 2026

Note

Medium Risk
Moderate risk: new log-parsing/indexing and vote/validation extraction logic could change report outputs if regexes or ordering assumptions don’t match real log formats; changes are confined to a standalone script.

Overview
Refactors the consensus report script into a clearer data pipeline: load and filter log entries for a given block height, build indexed views (by namespace and by (round, validator)), then derive per-round vote and proposal-validation results.

Adds vote parsing that detects the first Broadcasting Vote (prevote/precommit) after each Advancing step transition, and adds validation analysis that marks per-validator per-round proposal validation as Passed/Failed [N] with collected evidence messages. Also includes small robustness tweaks in height_match/get_round and new regexes/constants for vote detection.

Written by Cursor Bugbot for commit 4b12a91. This will update automatically on new commits. Configure here.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

lev-starkware commented Mar 11, 2026

frm, to = adv[0].lower(), adv[1].lower()
after_timestamp = parse_timestamp(e)

if frm == "propose" and to == "prevote" or frm == "prevote" and to == "precommit":
Copy link

Choose a reason for hiding this comment

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

Missing parentheses in compound boolean risks future bugs

Low Severity

The condition frm == "propose" and to == "prevote" or frm == "prevote" and to == "precommit" relies on implicit operator precedence (and binds tighter than or) to evaluate correctly. While the current logic happens to be correct, the missing parentheses make this expression fragile — any future modification (e.g., adding another and clause at the end) could silently change the semantics. Wrapping each conjunction in explicit parentheses would make the intent unambiguous.

Fix in Cursor Fix in Web

@lev-starkware lev-starkware force-pushed the pr10-consensus-report-data-pipeline branch from 77913ee to 4b12a91 Compare March 12, 2026 15:27
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

# Use word boundary regex to match height as complete number, not part of another number
pattern = rf"\b{re.escape(height_str)}\b"
return bool(re.search(pattern, jp.get("message") or ""))
return bool(re.search(pattern, jp.get("message", "")))
Copy link

Choose a reason for hiding this comment

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

Null message field causes TypeError in regex search

Medium Severity

The change from jp.get("message") or "" to jp.get("message", "") introduces a subtle semantic difference. If the "message" key exists in the JSON payload but has a None value (from JSON null), .get("message", "") returns None because the default only applies when the key is absent. This None then gets passed to re.search, causing a TypeError. Every other similar pattern in this file consistently uses or "" to guard against this.

Fix in Cursor Fix in Web

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.

2 participants