Skip to content

fix: move raw println to log for state compute#6683

Merged
hanabi1224 merged 1 commit intomainfrom
fix-println-state-compute
Mar 4, 2026
Merged

fix: move raw println to log for state compute#6683
hanabi1224 merged 1 commit intomainfrom
fix-println-state-compute

Conversation

@LesnyRumcajs
Copy link
Member

@LesnyRumcajs LesnyRumcajs commented Mar 3, 2026

Summary of changes

Changes introduced in this pull request:

  • raw stdout should not be used - it messes up any log aggregators and skews benchmark results

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • Chores
    • Enhanced state computation logging with structured tracing to improve observability of epoch, state root, receipt root, and computation duration metrics.

@LesnyRumcajs LesnyRumcajs requested a review from a team as a code owner March 3, 2026 12:40
@LesnyRumcajs LesnyRumcajs requested review from hanabi1224 and sudo-shashank and removed request for a team March 3, 2026 12:40
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2026

Walkthrough

A logging mechanism update in the state computation utility replaces a standard print statement with a structured tracing log. The println! call outputting epoch, state_root, receipt_root, and duration is replaced with tracing::info! for consistent, structured logging without altering control flow or validation logic.

Changes

Cohort / File(s) Summary
Logging Update
src/state_manager/utils.rs
Replaced println! with tracing::info! for structured logging of state computation metrics (epoch, state_root, receipt_root, duration).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested reviewers

  • hanabi1224
  • akaladarshi
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: replacing a println statement with structured logging for state compute. It is concise, clear, and accurately reflects the primary objective of the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-println-state-compute

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/state_manager/utils.rs (1)

320-323: Use structured tracing fields instead of interpolated message strings.

The tracing::info! call embeds all data in the message string, which prevents logging backends from indexing and filtering on individual values. Use dedicated fields for epoch, state_root, receipt_root, and duration.

Suggested refactor
-        tracing::info!(
-            "epoch: {epoch}, state_root: {state_root}, receipt_root: {receipt_root}, took {}.",
-            humantime::format_duration(start.elapsed())
-        );
+        tracing::info!(
+            epoch,
+            %state_root,
+            %receipt_root,
+            duration = %humantime::format_duration(start.elapsed()),
+            "state compute completed"
+        );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/state_manager/utils.rs` around lines 320 - 323, Replace the interpolated
tracing::info! message with structured fields so loggers can index values: emit
epoch, state_root, receipt_root and the elapsed duration as named fields (e.g.
epoch = %epoch, state_root = %state_root, receipt_root = %receipt_root, duration
= %humantime::format_duration(start.elapsed())) and provide a short static
message like "took" (or no message) instead of embedding values in the format
string; update the tracing::info! invocation in utils.rs accordingly so each
value is a separate field.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/state_manager/utils.rs`:
- Around line 320-323: Replace the interpolated tracing::info! message with
structured fields so loggers can index values: emit epoch, state_root,
receipt_root and the elapsed duration as named fields (e.g. epoch = %epoch,
state_root = %state_root, receipt_root = %receipt_root, duration =
%humantime::format_duration(start.elapsed())) and provide a short static message
like "took" (or no message) instead of embedding values in the format string;
update the tracing::info! invocation in utils.rs accordingly so each value is a
separate field.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f038322 and 209f7e2.

📒 Files selected for processing (1)
  • src/state_manager/utils.rs

@hanabi1224 hanabi1224 added this pull request to the merge queue Mar 3, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 3, 2026
@hanabi1224 hanabi1224 added this pull request to the merge queue Mar 4, 2026
Merged via the queue into main with commit 4197ec9 Mar 4, 2026
34 checks passed
@hanabi1224 hanabi1224 deleted the fix-println-state-compute branch March 4, 2026 02:03
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