cmd, helper, packaging, x/bor: granular logs#619
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
@claude review once |
There was a problem hiding this comment.
Pull request overview
This PR extends Heimdall’s logging configuration to support per-module log-level filtering (in addition to the existing single global level) and adds a regression test to detect polyproto Header field-population mismatches across the Bor gRPC boundary.
Changes:
- Add
helper.LogLevelOptionto parse either a plainlog_levelor amodule:levelfilter spec (with optional*:default). - Wire the new log-level parsing into
heimdalldroot command logger setup and config initialization. - Update mainnet/amoy
config.tomltemplates with syntax docs and common module names; add a Bor gRPC header encode/decode round-trip test.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
helper/log.go |
Introduces LogLevelOption to support both plain levels and per-module filter specs. |
helper/log_test.go |
Adds unit + end-to-end tests validating global level vs per-module filtering behavior. |
helper/config.go |
Uses LogLevelOption during config init and falls back to info on malformed specs. |
cmd/heimdalld/cmd/root.go |
Wires per-module log-level parsing into runtime logger initialization. |
packaging/templates/config/mainnet/config.toml |
Documents the new log_level syntax and common module names. |
packaging/templates/config/amoy/config.toml |
Mirrors the mainnet template documentation updates. |
x/bor/grpc/header_roundtrip_test.go |
Adds a polyproto Header marshal/unmarshal round-trip test to catch truncated-field population mismatches. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #619 +/- ##
=======================================
Coverage 50.0% 50.0%
=======================================
Files 180 181 +1
Lines 19854 19864 +10
=======================================
+ Hits 9934 9948 +14
+ Misses 8646 8643 -3
+ Partials 1274 1273 -1
... and 2 files with indirect coverage changes
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
LGTM — additive logging enhancement plus a polyproto Header round-trip test; no consensus or state impact.
Extended reasoning...
Overview
This PR is scoped to logging ergonomics and test coverage. helper.LogLevelOption accepts either a plain zerolog level (unchanged behavior) or a module:level list backed by cosmos-sdk's ParseLogLevel/FilterOption. It is wired into NewRootCmd and InitHeimdallConfigWith in place of the direct zerolog.ParseLevel call. The config.toml templates for mainnet and amoy get a documentation-only rewrite of the log_level comment. The new x/bor/grpc/header_roundtrip_test.go is a test-only addition that asserts the shipped polyproto Header round-trips to the canonical block hash.
Security risks
None material. Log parsing runs on operator-supplied config only, not external inputs, and a malformed spec falls back to InfoLevel in InitHeimdallConfigWith (matching the old behavior) or returns an error in NewRootCmd. No auth, crypto, or permission surface is touched.
Level of scrutiny
Low. This is operator-facing observability plumbing plus additive tests — none of the files matched by .claude/rules/consensus-critical.md or cross-chain.md are semantically changed, and the diff is not hardfork-shaped. Existing log_level = "info" configs parse exactly as before, so no coordinated upgrade is required.
Other factors
The new behavior is directly exercised by helper/log_test.go (plain, module-spec, wildcard-default, malformed cases plus an end-to-end FiltersRealLogger assertion). The polyproto test file is self-contained and non-functional. The reviewer explicitly requested a review pass. No bugs were flagged by the bug hunting system.
|



Summary
Adds per-module log-level filtering to Heimdall.
log_levelnow accepts either a single level applied globally (info,debug, … — unchanged behavior) or a comma-separated list ofmodule:levelpairs with an optional*:leveldefault, e.g.*:info,mempool:debug. This lets an operator scopedebugto one subsystem on a busy node without the firehose a global debug produces.The parsing lives in a new
helper.LogLevelOption: it tries a plainzerolog.ParseLevelfirst and falls back tocosmos-sdk'slogger.ParseLogLevel/FilterOptionfor the per-module form, wired intoNewRootCmd. Thelog_leveldocs in the mainnet and amoyconfig.tomltemplates now describe both forms and list the common CometBFT and Heimdall module names.Executed tests
helper/log_test.go— covers the plain-level path, themodule:levelfilter path, the*:defaultform, and the empty/invalid cases.Rollout notes
log_level = "info"(or any plain level) parses exactly as before — the per-module form is purely additive. No coordinated upgrade needed.log_levelnow accepts themodule:levelsyntax; existing configs keep working untouched.