← Back to Pull requests

feat: Log additions to relay #1446

Merged
Eric-Warehime merged 21 files (262 lines) on Sep 11, 2026 14:21 UTC
View on GitHub
Eric-Warehime Eric-Warehime commented on Sep 04, 2026 22:08 UTC
Author

Adds some logging to the attestor/relayer.

Most of this PR is just threading the logger through, with a couple of additions of info/warn and a few debug logs.

Diff: 262 lines (+208 / -54) across 21 files Reviewer: swift1337 Review duration: 9613m
All Vouch review confidence checks passed
Residual risk 0.09 = Change Risk (0.65) × (1 − Review Confidence (0.86)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.65 · 262 lines diff across 21 files
0.65
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.81 · 4 substantive comment(s)
0.81
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
85%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.333
Mass File Touch mass_file_touch
0.080
Real PR Conversation Timeline
6 items
greptile-apps[bot] greptile-apps[bot] commented on Sep 04, 2026 22:11 UTC
Bot

<h3>Greptile Summary</h3>

This PR threads structured loggers through relay processors and local and remote prover construction, then adds packet-submission, remote-proof, and attestor-quorum diagnostics.

  • Adds relay metadata and successful transaction hashes to packet-relay logs.

  • Logs remote prover results and individual attestor failures.

  • Warns when quorum succeeds despite excluded attestors.

  • Adds readable string formatting for relay kinds.

  • One observability issue remains: degraded-quorum warnings can omit conflicting or duplicate-signer exclusions when another attestor also errors.
  • <h3>Confidence Score: 4/5</h3>

    The PR appears safe to merge, with a non-blocking observability issue in degraded-quorum diagnostics.

    Logger propagation preserves the existing relay and proof behavior, and all discovered callers provide initialized loggers; however, one newly added warning can omit some attestor exclusion reasons and should be improved for reliable diagnosis.

    Files Needing Attention: cli/internal/relay/prover/attestation/quorum.go

    <h3>Important Files Changed</h3>

    | Filename | Overview |
    |----------|----------|
    | cli/internal/relay/prover/attestation/quorum.go | Adds attestor failure and degraded-quorum logging, but mixed exclusion reasons are not fully represented. |
    | cli/internal/relay/processors/batch_relay.go | Adds structured packet context and successful transaction logging around the existing relay flow. |
    | cli/internal/relay/prover/prover.go | Threads a client-scoped logger into local and remote prover construction. |
    | cli/internal/relay/prover/remote/remote.go | Stores a scoped logger and emits debug diagnostics after successful remote proof requests. |
    | cli/internal/types/v2/types.go | Adds stable human-readable names for all defined relay kinds. |

    <details><summary><h3>Flowchart</h3></summary>

    %%{init: {'theme': 'neutral'}}%%
    flowchart LR
      Bootstrap[Bootstrap logger] --> ProverSet[Prover set]
      Bootstrap --> Pipeline[Relay pipeline]
      ProverSet --> Local[Attestation generator]
      ProverSet --> Remote[Remote prover]
      Local --> Quorum[Attestor quorum queries]
      Pipeline --> Batch[Receive / Ack / Timeout batches]
      Batch --> Relay[Build and submit relay transaction]
      Quorum --> Logs[Structured diagnostics]
      Remote --> Logs
      Relay --> Logs
    

    </details>

    <!-- greptile_other_comments_section -->

    <sub>Reviews (1): Last reviewed commit: "Log additions to relay" | Re-trigger Greptile</sub>

    greptile-apps[bot] greptile-apps[bot] commented on code on Sep 04, 2026 22:11 UTC
    Code Review
    cli/internal/relay/prover/attestation/quorum.go:1
    @@ -150,6 +162,20 @@ func reduceQuorum(responses []quorumResponse, threshold int) (quorumResult, erro
     		}
     
     		if len(signatures) >= threshold {
    +			// quorum is met, but flag any attestors that did not contribute so a
    +			// degrading set is visible before it drops below threshold
    +			if len(signatures) < len(responses) {
    +				logger.Warn(
    +					"Attestation quorum met with some attestors excluded",
    +					"signatures", len(signatures),
    +					"attestors", len(responses),
    +					"threshold", threshold,
    +					"reasons", joinResponseErrors(responses),

    <a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> Quorum Reasons Are Incomplete

    The degraded-quorum warning can omit exclusion reasons when failure modes are mixed. Conflicting claims and duplicate signers are excluded without an error, while joinResponseErrors reports only responses with errors. If one attestor errors while another conflicts or duplicates a signer, the warning lists only the error, making it harder for operators to identify every attestor responsible for the reduced quorum.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

    swift1337 swift1337 commented on code on Sep 09, 2026 17:51 UTC
    Code Review
    cli/internal/relay/prover/attestation/generator.go:1
    @@ -23,18 +24,29 @@ type Generator struct {
     	attestors         []attestor.Attestor
     	threshold         int
     	counterpartyChain chains.Client
    +	logger            *slog.Logger
     }
     
    -func New(attestors []attestor.Attestor, threshold int, counterpartyChain chains.Client) *Generator {
    -	return &Generator{attestors: attestors, threshold: threshold, counterpartyChain: counterpartyChain}
    +func New(
    +	attestors []attestor.Attestor,
    +	threshold int,
    +	counterpartyChain chains.Client,
    +	logger *slog.Logger,
    +) *Generator {
    +	return &Generator{
    +		attestors:         attestors,
    +		threshold:         threshold,
    +		counterpartyChain: counterpartyChain,
    +		logger:            logger,
    +	}
     }
     
     func (g *Generator) LatestProvableHeight(ctx context.Context) (uint64, time.Time, error) {
    -	return latestProvableHeight(ctx, g.attestors, g.threshold, g.counterpartyChain)
    +	return latestProvableHeight(ctx, g.logger, g.attestors, g.threshold, g.counterpartyChain)

    For such cases I'd do someling like this:
    // prev code sets logging.Context(ctx, g.logger) - attaches slog to ctx,
    // log.FromContext() returns attached logger or slog.Default()

    	return latestProvableHeight(ctx, g.attestors, g.threshold, g.counterpartyChain)
    

    swift1337 swift1337 approved these changes on Sep 09, 2026 17:53 UTC
    Approved Reviewer

    Approved these changes.

    Eric-Warehime Eric-Warehime commented on code on Sep 11, 2026 14:00 UTC
    Code Review
    cli/internal/relay/prover/attestation/generator.go:1
    @@ -23,18 +24,29 @@ type Generator struct {
     	attestors         []attestor.Attestor
     	threshold         int
     	counterpartyChain chains.Client
    +	logger            *slog.Logger
     }
     
    -func New(attestors []attestor.Attestor, threshold int, counterpartyChain chains.Client) *Generator {
    -	return &Generator{attestors: attestors, threshold: threshold, counterpartyChain: counterpartyChain}
    +func New(
    +	attestors []attestor.Attestor,
    +	threshold int,
    +	counterpartyChain chains.Client,
    +	logger *slog.Logger,
    +) *Generator {
    +	return &Generator{
    +		attestors:         attestors,
    +		threshold:         threshold,
    +		counterpartyChain: counterpartyChain,
    +		logger:            logger,
    +	}
     }
     
     func (g *Generator) LatestProvableHeight(ctx context.Context) (uint64, time.Time, error) {
    -	return latestProvableHeight(ctx, g.attestors, g.threshold, g.counterpartyChain)
    +	return latestProvableHeight(ctx, g.logger, g.attestors, g.threshold, g.counterpartyChain)

    Mmmm, I tried it out and it's basically the same level of complexity just in a different place. Yes, you keep the logger out of the function signature in these cases, but it's inconsistent with the way the logger is passed in other places and you have to maintain the custom logger context stuff. I think we should just keep it as is.

    Reviewers
    Assignees
    Eric-Warehime Eric-Warehime
    Labels
    risk: low confidence: 85.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 64.9% (MEDIUM) · Higher = larger blast radius
    64.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 85.7% · Lower = rushed or shallow review
    85.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 9.3% · Safe to merge
    9.3%
    Repository