refactor(l1): make logger a functional option in NewClient - #3943
Open
Mgabal wants to merge 3 commits into
Open
Conversation
Prevent docs deployment from running on every push to main. Only trigger when files under docs/ or the workflow itself change. This avoids unnecessary CI usage and GitHub Pages deployments when unrelated code changes are pushed.
Move logger from a required positional parameter to a functional option via WithLogger(). This makes the logger optional with a sensible default (NopZapLogger) and keeps the API consistent with the existing opts ...Option pattern. Callers updated: - node/migration.go - node/node.go - l1/l1_test.go - l1/l1_pkg_test.go Closes NethermindEth#3820
brbrr
requested changes
Aug 14, 2026
brbrr
left a comment
Contributor
There was a problem hiding this comment.
Please take a look at inline comments
| - main | ||
| paths: | ||
| - 'docs/**' | ||
| - '.github/workflows/docs-deploy.yml' |
Contributor
There was a problem hiding this comment.
These changes are irrelevant to this PR
| // CatchUpChunkSize is the L1 block range per backward eth_getLogs request | ||
| // during the startup catch-up scan. | ||
| CatchUpChunkSize uint64 | ||
| CatchUpChunkSize uint64 |
Contributor
There was a problem hiding this comment.
Why did you remove the comment above?
Contributor
There was a problem hiding this comment.
Please double-check what your LLM generates. The comment was moved to the wrong field.
| } | ||
|
|
||
| return l1.NewClient(provider, chain, logger, l1Opts...), provider, nil | ||
| return l1.NewClient(provider, chain, append(l1Opts, l1.WithLogger(logger))...), provider, nil |
Contributor
There was a problem hiding this comment.
let's move the append from the function call.
- Remove accidental docs-deploy workflow changes - Restore CatchUpChunkSize comment in options struct - Move append outside NewClient call in node.go
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.
Summary
Closes #3820
Changes
Loggerfield to the internaloptionsstructWithLogger(log.StructuredLogger) Optionfunctional optionloggeras a required positional parameter fromNewClientlog.NewNopZapLogger()when not providednode/migration.go,node/node.gol1.WithLogger(nopLog)Motivation
Makes
NewClientconsistent with the existing functional-optionspattern already used for
EventListener,ResubscribeDelay,PollFinalisedInterval, andCatchUpChunkSize. Logger becomesoptional with a safe default rather than a required argument.