Skip to content

fix(bridge): correct error wrapping, trace_id key, and a log message#1095

Merged
sameh-farouk merged 1 commit into
developmentfrom
fix/bridge-error-wrap-logging
Jun 1, 2026
Merged

fix(bridge): correct error wrapping, trace_id key, and a log message#1095
sameh-farouk merged 1 commit into
developmentfrom
fix/bridge-error-wrap-logging

Conversation

@sameh-farouk
Copy link
Copy Markdown
Member

Summary

Three small diagnostics/observability fixes in the bridge, decomposed out of the larger #1079 work. No change to fund flow or control flow — purely what gets logged/reported. Bridge-only, no runtime upgrade.

Changes

1. Wrong error variable wrapped in Bridge.Start (bridge.go:149,193)

Both subscription arms check data.Err != nil but wrap the stale outer-scope err:

case data := <-tfchainSub:
    if data.Err != nil {
        return errors.Wrap(err, "failed to get tfchain events") // wraps stale `err`, not data.Err
    }

A real subscription failure was therefore reported with the wrong (often nil/empty) cause, masking the actual error on the bridge's exit path. Fixed to wrap data.Err in both arms.

2. trace_id always logged as <nil> (stellar.go:371)

The stellar_transaction_submitted success log read the trace id with the string key ctx.Value("trace_id"), but the value is stored under the typed key TraceIdKey{} (set in CreatePaymentWithSignaturesAndSubmit/CreateRefundPaymentWithSignaturesAndSubmit). So every submitted-tx log line emitted trace_id=<nil>. Note the sibling underfunded-alert log at stellar.go:356 already uses TraceIdKey{} correctly — this aligns the success log with it.

3. Copy-paste log message (client.go:66)

RetrySetWithdrawExecuted calls SetBurnTransactionExecuted but logged "error while setting refund transaction as executed". Corrected to "burn transaction".

Logic reasoning & regression-vector verification

Testing

  • go build ./... — OK
  • go vet ./... — OK
  • gofmt -l — clean

🤖 Generated with Claude Code

Three diagnostics/observability fixes (no behavior change to fund flow):

1. bridge.go: the tfchain and stellar subscription error branches checked
   `data.Err != nil` but wrapped the stale outer-scope `err`, so a real
   subscription failure was reported with the wrong/empty cause. Wrap
   `data.Err` in both arms.

2. stellar.go: the `stellar_transaction_submitted` success log read the
   trace id with the string key `ctx.Value("trace_id")`, but the value is
   stored under the typed key `TraceIdKey{}`, so trace_id was always
   logged as <nil>. Use `TraceIdKey{}`.

3. client.go: RetrySetWithdrawExecuted (which calls
   SetBurnTransactionExecuted) logged "setting refund transaction as
   executed". Corrected to "burn transaction".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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