Skip to content

fix: address validated multi-lens review findings (follow-up to #4338) - #4342

Merged
piotr-roslaniec merged 1 commit into
devfrom
fix/pr-4256-validated-findings
Sep 24, 2026
Merged

piotr-roslaniec merged 1 commit into
devfrom
fix/pr-4256-validated-findings

Conversation

@piotr-roslaniec

Copy link
Copy Markdown
Collaborator

Follow-up to the merged PR #4338. This addresses all P1, P2, P3 findings raised by the multi-lens validated review of #4338.

Summary

Fixes all valid issues identified by the validated multi-agent review of the original #4338 PR, which covered a defensive security/reliability fix-up. This commit applies the remaining actionable findings that #4338 did not address.

P1

  • F-01: add missing permissions: contents: read block to contracts-random-beacon.yml (the original fix: address validated review findings #4338 added it only to contracts-ecdsa.yml, despite the beacon workflow using the same secrets.CI_GITHUB_TOKEN for notify-workflow-completed and the same yarn up pattern).
  • F-03: document the new redemptions overflow-fallback semantics in code. When txMaxFee * requestCount overflows, the old code wrapped to 0 and rejected every estimate; the new code falls back to txMaxTotalFee. This semantic change is intentional (covered by the "huge per-request cap" test) but was not called out in fix: address validated review findings #4338's PR body.
  • F-04: declare the EnableServer(port int) backwards-incompatible breaking change in godoc. The previous implementation implicitly exposed pprof via http.DefaultServeMux; the new implementation calls enableServer(port, false) and unconditionally disables pprof. No in-repo callers; external consumers would silently lose pprof functionality.

P2

  • F-05: drop the redundant Maintainer.Validate() call in maintainer.Initialize since spv.Initialize still validates at the use-site boundary. Reduces 3 identical validation passes per command to 2.
  • F-06: correct Maintainer.Validate() godoc — it currently validates only Spv, not "all modules" as the docstring claimed.
  • F-07: document the dormant net/http/pprof DefaultServeMux side-effect in the clientinfo package doc and point registerPprofHandlers at it. The current code builds a private ServeMux so the registration is dormant, but any future contributor adding a nil-handler ListenAndServe call would silently expose pprof.
  • F-09: remove the redundant double error wrapper in maintainer.Initialize ("cannot validate spv maintainer config: cannot validate spv maintainer config: ...").

P3

  • F-10: reword the DKG malformed-key comment to lead with the current behavior (mark sender inactive so the protocol can continue) rather than past-tense framing.
  • F-12: rename the "huge per-request cap does not wrap to zero" test case to "huge per-request cap falls back to txMaxTotalFee" — the new code's skip branch is what's exercised, not a multiplication overflow that wraps to 0.

Skipped

  • F-11 (replace sanitizeServerURL with (*url.URL).Redacted()) was reviewed and skipped: Go 1.15+ Redacted() keeps the username (only masks the password), which leaks more than the manual "strip everything" implementation currently in place. The manual version is intentionally more conservative for Electrum server credentials and was kept.

Verification

  • gofmt -l . clean
  • go vet clean
  • go build ./... clean
  • targeted tests pass:
    • go test ./pkg/maintainer/... ok
    • go test ./pkg/clientinfo/... ok
    • go test ./pkg/bitcoin/electrum/... ok
    • go test -run TestApplyWalletTxFeePolicy ./pkg/tbtc/... ok
    • go test ./pkg/tbtcpg/... ok
    • go test -run TestGenerateSymmetricKeys ./pkg/tecdsa/dkg/... ok
    • go test ./config/... ok

Related

P1:
- add missing permissions block to contracts-random-beacon.yml (F-01)
- document redemptions overflow-fallback semantic change (F-03)
- declare EnableServer pprof-disabled breaking change in godoc (F-04)

P2:
- drop redundant Maintainer.Validate() call in maintainer.Initialize
  since spv.Initialize still validates at the use-site boundary (F-05)
- correct Maintainer.Validate() godoc: it validates Spv, not 'all modules' (F-06)
- document the dormant net/http/pprof DefaultServeMux side-effect in
  the clientinfo package doc and point registerPprofHandlers at it (F-07)
- remove the redundant double error wrapper in maintainer.Initialize (F-09)

P3:
- reword DKG malformed-key comment to lead with current behavior rather
  than past-tense framing (F-10)
- rename the redemptions overflow test case to reflect the branch
  actually exercised (fallback-to-txMaxTotalFee, not wrap-to-zero) (F-12)

F-11 (replace sanitizeServerURL with (*url.URL).Redacted()) was reviewed
and skipped: Redacted() keeps the username (only masks the password),
which leaks more than the manual strip-everything implementation
currently in place; the manual version is intentionally more conservative
for Electrum server credentials. Kept as-is.
@coderabbitai

coderabbitai Bot commented Sep 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 3aefeeeb-68e9-44a8-b7e0-fce51a6f97fa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@piotr-roslaniec
piotr-roslaniec merged commit 5b51530 into dev Sep 24, 2026
38 checks passed
@piotr-roslaniec
piotr-roslaniec deleted the fix/pr-4256-validated-findings branch September 24, 2026 16:51
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