Skip to content

Improve logging of rewindHeight when handling un-finalized blocks #3018

Open
lorrod wants to merge 2 commits intosubquery:mainfrom
lorrod:main
Open

Improve logging of rewindHeight when handling un-finalized blocks #3018
lorrod wants to merge 2 commits intosubquery:mainfrom
lorrod:main

Conversation

@lorrod
Copy link

@lorrod lorrod commented Feb 27, 2026

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • I have tested locally
  • I have performed a self review of my changes
  • Updated any relevant documentation
  • Linked to any relevant issues
  • I have added tests relevant to my changes
  • Any dependent changes have been merged and published in downstream modules
  • My code is up to date with the base branch
  • I have updated relevant changelogs. We suggest using chan

Summary by CodeRabbit

  • Chores
    • Improved logging clarity for internal debugging purposes with enhanced object formatting.

@coderabbitai
Copy link

coderabbitai bot commented Feb 27, 2026

📝 Walkthrough

Walkthrough

Added util import to enhance logging output formatting for rewind height information in the unfinalized blocks service. The util.inspect method now formats rewindHeight objects with depth 6 for improved readability in logs.

Changes

Cohort / File(s) Summary
Logging Enhancement
packages/node-core/src/indexer/unfinalizedBlocks.service.ts
Added util import and applied util.inspect() formatting to rewindHeight logging statements for improved log readability.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A rabbit hops through logs so deep,
With util.inspect, secrets to keep,
Six levels down, in colors' farewell,
The rewind path now shows far too well! 🐰✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: improving logging of rewindHeight during un-finalized block handling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

@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)
packages/node-core/src/indexer/unfinalizedBlocks.service.ts (1)

18-18: Fix import order to satisfy ESLint import/order.

Line 18 places node:util after local imports; this violates the reported rule and may fail lint checks.

Proposed diff
 import assert from 'assert';
+import util from 'node:util';
 import {Inject, Injectable} from '@nestjs/common';
 import {OnEvent} from '@nestjs/event-emitter';
 import {Transaction} from '@subql/x-sequelize';
 import {isEqual, last} from 'lodash';
 import {IBlockchainService} from '../blockchain.service';
 import {NodeConfig} from '../configure';
 import {IndexerEvent} from '../events';
 import {Header, IBlock} from '../indexer/types';
 import {getLogger} from '../logger';
 import {mainThreadOnly} from '../utils';
 import {ProofOfIndex} from './entities';
 import {PoiBlock} from './poi';
 import {IStoreModelProvider} from './storeModelProvider';
-import util from 'node:util';

As per coding guidelines, "Run ESLint with TypeScript support, Prettier, and various plugins across all TypeScript files using configured husky pre-commit hooks and lint-staged".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/node-core/src/indexer/unfinalizedBlocks.service.ts` at line 18,
Reorder the imports so Node built-ins come before local/project imports: move
the line "import util from 'node:util';" to the top of
packages/node-core/src/indexer/unfinalizedBlocks.service.ts (before any local
imports) to satisfy ESLint import/order; then run the linter/formatters (ESLint
+ Prettier) or the project's husky pre-commit hooks to confirm the rule passes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/node-core/src/indexer/unfinalizedBlocks.service.ts`:
- Line 18: Reorder the imports so Node built-ins come before local/project
imports: move the line "import util from 'node:util';" to the top of
packages/node-core/src/indexer/unfinalizedBlocks.service.ts (before any local
imports) to satisfy ESLint import/order; then run the linter/formatters (ESLint
+ Prettier) or the project's husky pre-commit hooks to confirm the rule passes.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f136cbb and c79f352.

📒 Files selected for processing (1)
  • packages/node-core/src/indexer/unfinalizedBlocks.service.ts

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.

1 participant