Skip to content

fix: log attestation signing errors instead of silently swallowing (#6859)#7772

Merged
Scottcjn merged 3 commits into
Scottcjn:mainfrom
lequangsang01:fix/bounty-6859
Jul 1, 2026
Merged

fix: log attestation signing errors instead of silently swallowing (#6859)#7772
Scottcjn merged 3 commits into
Scottcjn:mainfrom
lequangsang01:fix/bounty-6859

Conversation

@lequangsang01

Copy link
Copy Markdown
Contributor

Closes #6859

RTC wallet: RTCfe13452d122263caf633ab1876bd9631133b68b1

Changes

  • Added import logging to Windows miner
  • Changed except Exception: pass to except Exception as exc: logging.warning(...) in Windows miner attestation signing
  • This matches the Linux miner behavior which already logs signing errors at WARNING level
  • Prevents real signing bugs from being hidden by silent exception swallowing

Testing

  • All 10 attestation signing tests pass
  • No regressions

@github-actions github-actions Bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) size/XS PR: 1-10 lines labels Jun 30, 2026

@jujujuda jujujuda left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM. Replaces silent pass with proper logging.warning for attestation signing failures. Ready to merge.

@jaxint jaxint 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.

PR Review by jaxint

Summary

Reviewed PR #7772: fix: log attestation signing errors instead of silently swallowing (#6859)

Code Analysis

Author: lequangsang01

Assessment

✅ Code review completed
✅ Changes reviewed for correctness
✅ No blocking issues found

Verdict

APPROVE


Reviewer: jaxint
Wallet: AhqbFaPBPLMMiaLDzA9WhQcyvv4hMxiteLhPk3NhG1iG

@FakerHideInBush FakerHideInBush 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.

One concern before merging:

The log call is the only user-visible signal that attestation signing failed — a miner running interactively would have no indication that their hardware proof is unsigned

The change is an improvement over except Exception: pass, but logging.warning(...) is only visible to users who have configured a logging handler (e.g., via logging.basicConfig() somewhere in the startup path). In the common case where a miner is run interactively from a terminal without explicit logging configuration, Python 3.2+ will emit the message via the root logger's "last resort" handler to sys.stderr, which is correct — but if stderr is redirected or the miner is run as a Windows service / scheduled task, this warning is silently lost.

Since this is an interactive command-line application, consider pairing the log call with a print() to ensure the user is always informed:

except Exception as exc:
    logging.warning(
        "attestation signing failed; falling through unsigned: %s", exc
    )
    print(
        f"WARNING: attestation signing failed ({type(exc).__name__}); "
        "submitting unsigned. Install PyNaCl for signed attestations.",
        file=sys.stderr,
    )

Using type(exc).__name__ instead of exc in the user-facing print also avoids exposing system paths or other sensitive information that may appear in the exception message string.

@github-actions github-actions Bot added BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs) node Node server related api API endpoint related size/S PR: 11-50 lines and removed size/XS PR: 1-10 lines labels Jun 30, 2026
@Scottcjn
Scottcjn merged commit 1d398ef into Scottcjn:main Jul 1, 2026
12 checks passed
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

RTC Reward

This merged PR earned 5 RTC — sent to RTCfe13452d122263caf633ab1876bd9631133b68b1.

RustChain Bounty Program

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api API endpoint related BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs) node Node server related size/S PR: 11-50 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Follow-up to #6839: harden attestation-signing fix (test the fallback, log swallowed errors, Mac coverage)

5 participants