scripts: consensus report data pipeline — load, index, extract votes and validation#13205
Conversation
e8c1c6f to
9e0922d
Compare
7466c27 to
1d60cd8
Compare
| 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": |
There was a problem hiding this comment.
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.
1d60cd8 to
6cd09ab
Compare
9e0922d to
77913ee
Compare
77913ee to
4b12a91
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
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", ""))) |
There was a problem hiding this comment.
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.



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 eachAdvancing steptransition, and adds validation analysis that marks per-validator per-round proposal validation asPassed/Failed [N]with collected evidence messages. Also includes small robustness tweaks inheight_match/get_roundand new regexes/constants for vote detection.Written by Cursor Bugbot for commit 4b12a91. This will update automatically on new commits. Configure here.