rpc/jsonrpc, db/consensuschain: pass a logger to the consensus chain reader - #22859
Open
awskii wants to merge 2 commits into
Open
rpc/jsonrpc, db/consensuschain: pass a logger to the consensus chain reader#22859awskii wants to merge 2 commits into
awskii wants to merge 2 commits into
Conversation
…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.
awskii
requested review from
AskAlexSharov,
lupin012,
sudeepdino008 and
yperbasis
as code owners
July 29, 2026 10:10
AskAlexSharov
approved these changes
Jul 29, 2026
AskAlexSharov
enabled auto-merge
July 29, 2026 10:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
consensuschain.NewReaderwas called with a nil logger atrpc/jsonrpc/trace_filtering.go:840and:1179— while a real logger was being created on the next line and passed toInitializeBlockExecution.log.Loggeris an interface, so those readers hold a nil interface.GetTdcallscr.logger.Warnon its error path, which means aReadTddecode or DB failure reached throughtrace_filteringpanics the trace RPC instead of logging and returning nil.Changes
trace_filtering_test.go.NewReaderfalls back tolog.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 copyGetTdtoday is that a nil logger would panic. See #18230.