fix: move raw println to log for state compute#6683
Conversation
WalkthroughA logging mechanism update in the state computation utility replaces a standard print statement with a structured tracing log. The Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 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 forepoch,state_root,receipt_root, andduration.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.
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
Closes
Other information and links
Change checklist
Outside contributions
Summary by CodeRabbit