Skip to content

rpc/jsonrpc, db/consensuschain: pass a logger to the consensus chain reader - #22859

Open
awskii wants to merge 2 commits into
mainfrom
awskii/consensuschain-nil-logger
Open

rpc/jsonrpc, db/consensuschain: pass a logger to the consensus chain reader#22859
awskii wants to merge 2 commits into
mainfrom
awskii/consensuschain-nil-logger

Conversation

@awskii

@awskii awskii commented Jul 29, 2026

Copy link
Copy Markdown
Member

consensuschain.NewReader was called with a nil logger at rpc/jsonrpc/trace_filtering.go:840 and :1179 — while a real logger was being created on the next line and passed to InitializeBlockExecution.

log.Logger is an interface, so those readers hold a nil interface. GetTd calls cr.logger.Warn on its error path, which means a ReadTd decode or DB failure reached through trace_filtering panics the trace RPC instead of logging and returning nil.

Changes

  • Pass the logger that was already there at both call sites, and in trace_filtering_test.go.
  • NewReader falls back to log.Root() when given nil, so the same mistake cannot come back.

This also unblocks surfacing the errors the other reader methods drop with h, _ := — the reason they can't just copy GetTd today is that a nil logger would panic. See #18230.

…reader

trace_filtering built the Reader with a nil logger while creating a real one
on the next line. log.Logger is an interface, so GetTd's error path panics
on those readers instead of logging.

NewReader falls back to log.Root() so the same mistake cannot come back.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@awskii
awskii requested a review from Copilot July 29, 2026 10:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@awskii
awskii requested a review from Copilot July 29, 2026 10:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@AskAlexSharov
AskAlexSharov enabled auto-merge July 29, 2026 10:17
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.

3 participants