Skip to content

add debug and trace logs across funding flow#1312

Open
doitian wants to merge 1 commit intonervosnetwork:developfrom
doitian:funding-debug-trace-logs
Open

add debug and trace logs across funding flow#1312
doitian wants to merge 1 commit intonervosnetwork:developfrom
doitian:funding-debug-trace-logs

Conversation

@doitian
Copy link
Copy Markdown
Member

@doitian doitian commented Apr 28, 2026

Summary

Adds structured debug and trace level logs throughout the funding flow so
that channel-open failures can be diagnosed without reproducing under a
debugger. Previously, failures only surfaced at the retry scheduler with
the bare FundingError, leaving operators to guess which stage went
wrong (cell collection, balancing, signing, peer verification, broadcast,
or tracing).

Changes

  • ckb/funding/funding_tx.rs
    • Log entry context for FundingTxBuilder::build, build_funding_cell,
      build_udt_inputs_outputs, build_base_from_funding_cell, and
      build_and_balance_tx (amounts, reserves, fee rate, source lock hash,
      tip block, exclusion-map size).
    • Identify which checked_add overflowed in build_funding_cell.
    • Trace per-batch UDT cell collection and emit a debug log on the
      "insufficient UDT cells" path showing exact found vs needed.
    • Log balanced tx hash + input/output/cell-dep counts.
    • Log signing entry/exit and peer tx verification context with both
      local and remote tx hashes and counts.
  • ckb/actor.rsFund, BuildUnsignedFundingTx, VerifyFundingTx,
    Sign, and SendTx handlers now log requests and outcomes.
  • fiber/in_flight_ckb_tx_actor.rs — derive Debug for
    InFlightCkbTxKind and include tx_hash + tx_kind in start,
    send_tx_interval, send_tx, and report_tracing_result logs.
  • fiber/network.rs — add entry context (channel_id, attempt,
    amounts, target peer, tx_hash) for do_update_channel_funding,
    do_sign_funding_tx, fund, send_tx, and abort_funding.

Verification

  • cargo check -p fnn -p fiber-bin
  • cargo clippy --all-targets --all-features -p fnn -p fiber-bin -- -D warnings
  • cargo fmt --all

No behavioral changes; only logging additions and a single derived
Debug impl.


This PR description was generated with AI assistance.

Channel-open failures currently surface only at the retry scheduler
without enough context to diagnose where in the funding pipeline things
went wrong. Add structured debug/trace logs at each significant stage so
operators can correlate failures with amounts, peer/channel ids, and
tx hashes.

- funding_tx: log build entry, UDT cell collection progress and
  insufficient-cells gap, balanced tx hash + counts, signing, and
  peer tx verification context; identify which checked_add overflowed.
- ckb actor: log Fund/BuildUnsignedFundingTx/VerifyFundingTx/Sign/
  SendTx requests with amounts, source lock hash and outcomes.
- in_flight_ckb_tx_actor: derive Debug for InFlightCkbTxKind and
  include tx_hash + tx_kind in start, send_tx, and tracing-result logs.
- network: log entry context (channel_id, attempt, amounts, target
  peer, tx_hash) for do_update_channel_funding, do_sign_funding_tx,
  fund, send_tx, and abort_funding.
Copy link
Copy Markdown
Collaborator

@chenyukang chenyukang left a comment

Choose a reason for hiding this comment

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

Reviewed the changes and found no blocking issues.

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.

2 participants