Skip to content

feat: add gossip metrics benchmarks and CI integration#1177

Merged
quake merged 6 commits intonervosnetwork:developfrom
swananan:feat/gossip-metrics-bench-ci
Apr 14, 2026
Merged

feat: add gossip metrics benchmarks and CI integration#1177
quake merged 6 commits intonervosnetwork:developfrom
swananan:feat/gossip-metrics-bench-ci

Conversation

@swananan
Copy link
Copy Markdown
Contributor

@swananan swananan commented Mar 8, 2026

Summery

This PR adds baseline gossip observability and benchmark coverage before protocol optimization. #1087

It includes 4 parts:

1. new Criterion benchmarks (NetworkNode based)

Criterion Benchmarks (NetworkNode-based)

Added two new benches:

gossip_propagation:

- builds a multi-node synthetic topology,
- triggers channel updates,
- measures propagation to observer nodes,
- reports latency distribution (P50/P90/P99 summary).
GOSSIP_BENCH_NODE_COUNTS=10 GOSSIP_BENCH_MAX_OBSERVERS=8 cargo bench -p fnn --features bench --bench gossip_propagation -- --warm-up-time 1 --measurement-time 3 --sample-size 10
    Finished `bench` profile [optimized] target(s) in 0.31s
     Running benches/gossip_propagation.rs (target/release/deps/gossip_propagation-006779503b1d6065)
Gnuplot not found, using plotters backend
message_propagation_summary node_count=10 rounds=19 samples=152 min_ms=6.14 avg_ms=46.55 p50_ms=49.53 p90_ms=93.31 p99_ms=100.00 max_ms=100.07
Benchmarking gossip_channel_update_propagation_multi_node/update_to_observers/10: Warming up for 1.0000 s
Warning: Unable to complete 10 samples in 3.0s. You may wish to increase target time to 4.8s or enable flat sampling.
Benchmarking gossip_channel_update_propagation_multi_node/update_to_observers/10: Collecting 10 samples in estimated 4.7765 s (55 ite
gossip_channel_update_propagation_multi_node/update_to_observers/10
                        time:   [83.750 ms 89.134 ms 94.716 ms]
                        thrpt:  [10.558  elem/s 11.219  elem/s 11.940  elem/s]
                 change:
                        time:   [+4.3179% +16.130% +28.338%] (p = 0.01 < 0.05)
                        thrpt:  [-22.081% -13.890% -4.1392%]
                        Performance has regressed.

gossip_sync_recovery:

- takes one node offline,
- creates backlog updates while offline,
- reconnects the node,
- measures time to graph parity (recovery completion).
FNN_EVENT_WAIT_TIMEOUT_SECS=180 \
  GOSSIP_SYNC_RECOVERY_NODE_COUNTS=4 \
  GOSSIP_SYNC_RECOVERY_BACKLOG_UPDATES=20 \
  GOSSIP_SYNC_RECOVERY_RECONNECT_PEERS=1 \
  GOSSIP_SYNC_RECOVERY_PARITY_TIMEOUT_SECS=60 \
  GOSSIP_BENCH_NETWORK_INTERVAL_MS=50 \
  GOSSIP_BENCH_STORE_INTERVAL_MS=50 \
  cargo bench -p fnn --features bench --bench gossip_sync_recovery -- --warm-up-time 1 --measurement-time 3 --sample-size 10
    Finished `bench` profile [optimized] target(s) in 0.32s
     Running benches/gossip_sync_recovery.rs (target/release/deps/gossip_sync_recovery-8ba04823c18d7342)
Gnuplot not found, using plotters backend
Benchmarking gossip_sync_recovery/reconnect_to_parity/4: Warming up for 1.0000 s
Warning: Unable to complete 10 samples in 3.0s. You may wish to increase target time to 16.4s.
gossip_sync_recovery/reconnect_to_parity/4
                        time:   [1.5780 s 1.5879 s 1.5936 s]
                        thrpt:  [0.6275  elem/s 0.6298  elem/s 0.6337  elem/s]
                 change:
                        time:   [-1.0421% +0.0025% +1.0566%] (p = 1.00 > 0.05)
                        thrpt:  [-1.0456% -0.0025% +1.0531%]
                        No change in performance detected.
Found 2 outliers among 10 measurements (20.00%)
  1 (10.00%) low severe
  1 (10.00%) low mild

2. new gossip metrics

Added the following metrics:

  • fiber.gossip.received_broadcast_messages_total
  • fiber.gossip.applied_broadcast_messages_total
  • fiber.gossip.duplicate_broadcast_messages_total
  • fiber.gossip.rejected_broadcast_messages_total
  • fiber.gossip.received_bytes_total
  • fiber.gossip.sent_bytes_total
  • fiber.gossip.propagation_received_latency_ms
  • fiber.gossip.propagation_applied_latency_ms
  • fiber.gossip.propagation_samples_skipped_total
  • fiber.gossip.active_sync_completion_ms
  • fiber.gossip.active_sync_started_total
  • fiber.gossip.active_sync_finished_total
  • fiber.gossip.active_sync_timeout_total
  • fiber.gossip.missing_dependency_messages_total
  • fiber.gossip.dependency_query_requests_total
  • fiber.gossip.dependency_query_items_total

Also configured dedicated histogram buckets for gossip latency metrics, using millisecond boundaries [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 60000] to capture both fast propagation and long-tail sync delays with consistent percentile/coverage analysis.

3. new perf benchmark flow

Extended tests/perf with gossip-benchmark modes:

  • steady: sends updates at a fixed interval (--interval-ms), so load is smooth and constant over time.
  • burst: sends as many updates as needed to hit --burst-updates-per-window within each --burst-window-ms, so load is spiky (high short-term pressure, then wait for next window).

gossip-benchmark takes two metric snapshots (before / after) and computes deltas from new metrics.

How outputs are calculated from metrics:

  • recv_msg / applied / dup / rejected / recv_bytes / sent_bytes:
    • delta of corresponding counters between snapshots.
  • duplicate_rate:
    • duplicate_broadcast_messages_delta / received_broadcast_messages_delta.
  • rejected_rate:
    • rejected_broadcast_messages_delta / received_broadcast_messages_delta.
  • bytes_per_applied:
    • (received_bytes_delta + sent_bytes_delta) / applied_broadcast_messages_delta.
  • latency avg/p50/p90/p99/max and <=50/100/200/500ms coverage:
    • computed from the delta histogram of fiber.gossip.propagation_applied_latency_ms (filtered to message_type=channel_update).
  • full_convergence / avg_convergence:
    • derived from observer-side applied-latency histogram sample counts vs total updates sent.

Outputs include:

cargo run --bin run-test -- gossip-benchmark steady --duration-secs 60 --interval-ms 50 --result-mode base
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.07s
     Running `target/debug/run-test gossip-benchmark steady --duration-secs 60 --interval-ms 50 --result-mode base`
🎯 Starting gossip benchmark test...
📊 Parameters: load_mode=steady, duration=60s, interval=50ms, burst=0 updates/1000ms, result_mode=base

🚀 Gossip benchmark test:
  - source node: node2
  - observed nodes: node1,node3
  - workload channels: 2
    * node2 -> node1 | 0xa2f3f29e298ff0b771d8f3402d5712d921b3018380bb8b5f9a7577f232843d46 (0x97957619c4559625182ac0da0474a28e9615f507a0ad1c8e742e8b21fb6d2ab700000000)
    * node2 -> node3 | 0xc513fba9fa0abb6e662448f062379d0a0516967af325834a6093ace9b91cdd3d (0xd55f3bd0c2817a2338ce1e4b6020204fcea5951bcf05d3f23d82769504d93bd600000000)
  - duration: 60s
  - load mode: steady
  - update interval: 50ms
  - burst target: 0 updates per 1s
  - metrics endpoints: http://127.0.0.1:29114/metrics, http://127.0.0.1:29115/metrics, http://127.0.0.1:29116/metrics

🎯 Gossip benchmark results:
=====================================
Test duration: 60.00 seconds
Load profile: mode=steady, interval=50ms, burst_target=0 updates/1000ms, burst_windows=0
Scope: observer metrics = node1,node3 (combined)
Scope: network counters = node1,node2,node3 (sum delta)
Latency source: fiber.gossip.propagation_applied_latency_ms histogram (percentiles are estimates)
Total updates: 1069
Updates/sec: 17.82
Pressure send rate: peak=17.82 updates/sec, burst_updates_sent=0
Workload distribution:
  - node2 -> node1 | channel=0xa2f3f29e298ff0b771d8f3402d5712d921b3018380bb8b5f9a7577f232843d46 | updates=535
  - node2 -> node3 | channel=0xc513fba9fa0abb6e662448f062379d0a0516967af325834a6093ace9b91cdd3d | updates=534
Full convergence: 1062/1069 (99.35%)
Average convergence rate: 99.39%
Latency(ms): avg=522.70, p50=523.32, p90=919.78, p99=1475.00, max=2000.00
Latency coverage: <=50ms 2.16%, <=100ms 7.20%, <=200ms 17.88%, <=500ms 47.67%
Metrics deltas: recv_msg=7461, applied=2125, dup=501, rejected=4400, recv_bytes=1620740, sent_bytes=1636036
Derived: duplicate_rate=6.71%, rejected_rate=58.97%, bytes_per_applied=1532.60
=====================================

📊 Gossip baseline saved to: gossip_baseline.json
💾 Gossip baseline benchmark results saved to gossip_baseline.json
cargo run --bin run-test -- gossip-benchmark burst --duration-secs 60 --burst-updates-per-window 200 --burst-window-ms 1000  --result-mode base
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.06s
     Running `target/debug/run-test gossip-benchmark burst --duration-secs 60 --burst-updates-per-window 200 --burst-window-ms 1000 --result-mode base`
🎯 Starting gossip benchmark test...
📊 Parameters: load_mode=burst, duration=60s, interval=0ms, burst=200 updates/1000ms, result_mode=base
🚀 Gossip benchmark test:
  - source node: node2
  - observed nodes: node1,node3
  - workload channels: 2
    * node2 -> node1 | 0xa2f3f29e298ff0b771d8f3402d5712d921b3018380bb8b5f9a7577f232843d46 (0x97957619c4559625182ac0da0474a28e9615f507a0ad1c8e742e8b21fb6d2ab700000000)
    * node2 -> node3 | 0xc513fba9fa0abb6e662448f062379d0a0516967af325834a6093ace9b91cdd3d (0xd55f3bd0c2817a2338ce1e4b6020204fcea5951bcf05d3f23d82769504d93bd600000000)
  - duration: 60s
  - load mode: burst
  - update interval: 0ns
  - burst target: 200 updates per 1s
  - metrics endpoints: http://127.0.0.1:29114/metrics, http://127.0.0.1:29115/metrics, http://127.0.0.1:29116/metrics

🎯 Gossip benchmark results:
=====================================
Test duration: 60.00 seconds
Load profile: mode=burst, interval=0ms, burst_target=200 updates/1000ms, burst_windows=60
Scope: observer metrics = node1,node3 (combined)
Scope: network counters = node1,node2,node3 (sum delta)
Latency source: fiber.gossip.propagation_applied_latency_ms histogram (percentiles are estimates)
Total updates: 12000
Updates/sec: 200.00
Pressure send rate: peak=529.79 updates/sec, burst_updates_sent=12000
Workload distribution:
  - node2 -> node1 | channel=0xa2f3f29e298ff0b771d8f3402d5712d921b3018380bb8b5f9a7577f232843d46 | updates=6000
  - node2 -> node3 | channel=0xc513fba9fa0abb6e662448f062379d0a0516967af325834a6093ace9b91cdd3d | updates=6000
Full convergence: 12000/12000 (100.00%)
Average convergence rate: 100.00%
Latency(ms): avg=638.98, p50=716.04, p90=943.21, p99=994.32, max=1000.00
Latency coverage: <=50ms 0.00%, <=100ms 0.00%, <=200ms 0.00%, <=500ms 11.96%
Metrics deltas: recv_msg=83400, applied=24000, dup=477, rejected=58921, recv_bytes=18069600, sent_bytes=18387840
Derived: duplicate_rate=0.57%, rejected_rate=70.65%, bytes_per_applied=1519.06
=====================================

📊 Gossip baseline saved to: gossip_baseline.json
💾 Gossip baseline benchmark results saved to gossip_baseline.json

Supports baseline/compare report generation.

4. CI updates to run and compare benchmarks safely

Updated benchmark CI flow to include gossip benchmark in a safe bootstrap way:

  • keeps baseline/current startup symmetric,
  • only runs gossip compare when baseline branch supports required metrics flow,
  • otherwise runs bootstrap mode and skips gossip regression gating,
  • includes clear TODO/comments to switch to strict always-on compare later.

Notes

One open question is whether we should run these benchmarks with production-like gossip intervals (60s/20s) instead of test-friendly intervals. Current settings are chosen to keep runtime practical and feedback fast, but they may not fully reflect production behavior. I’d like feedback on whether we should switch to production values (or keep both fast-mode and prod-mode runs).

This PR is shared early to discuss and validate the overall direction first (metrics scope, benchmark design, and CI strategy) before moving to deeper optimization changes.

@chenyukang
Copy link
Copy Markdown
Collaborator

I prefer to run as production-like gossip intervals first, and gossip performance benchmark may don't need to be in CI, since we will not change this part frequently.

it's good if we can run benchmark for this part for every release, or we just track the performance change by running a cron job like this: https://sunchengzhu.github.io/fiber-ci-metrics/

@quake what's your opinions for metrics?

@swananan
Copy link
Copy Markdown
Contributor Author

Sure, I’ve switched the benchmarks to production-like gossip intervals. For the perf tests, we can use macros to configure the interval settings. And I also removed the ci changes.

Gossip Benchmark result

FNN_EVENT_WAIT_TIMEOUT_SECS=180 \
  GOSSIP_SYNC_RECOVERY_NODE_COUNTS=4 \
  GOSSIP_SYNC_RECOVERY_BACKLOG_UPDATES=20 \
  GOSSIP_SYNC_RECOVERY_RECONNECT_PEERS=1 \
  GOSSIP_SYNC_RECOVERY_PARITY_TIMEOUT_SECS=1200 \
  cargo bench -p fnn --features bench --bench gossip_sync_recovery -- --warm-up-time 1 --measurement-time 3 --sample-size 10
    Finished `bench` profile [optimized] target(s) in 0.29s
     Running benches/gossip_sync_recovery.rs (target/release/deps/gossip_sync_recovery-8ba04823c18d7342)
Gnuplot not found, using plotters backend
Benchmarking gossip_sync_recovery/reconnect_to_parity/4: Warming up for 1.0000 s
Warning: Unable to complete 10 samples in 3.0s. You may wish to increase target time to 813.2s.
gossip_sync_recovery/reconnect_to_parity/4
                        time:   [81.257 s 81.272 s 81.286 s]
                        thrpt:  [0.0123  elem/s 0.0123  elem/s 0.0123  elem/s]
                 change:
                        time:   [-0.0337% -0.0101% +0.0140%] (p = 0.44 > 0.05)
                        thrpt:  [-0.0140% +0.0101% +0.0337%]
                        No change in performance detected.
Found 3 outliers among 10 measurements (30.00%)
  1 (10.00%) low severe
  1 (10.00%) low mild
  1 (10.00%) high mild

- add gossip protocol metrics counters/histograms and active-sync/query observability

- add criterion gossip benchmarks for multi-node propagation and sync-recovery

- add tests/perf gossip benchmark flows driven by metrics (steady/burst + baseline/compare)

- integrate benchmark CI with metrics-enabled startup and bootstrap gossip regression gating
@swananan swananan force-pushed the feat/gossip-metrics-bench-ci branch from 41eec78 to 5dd32a1 Compare March 29, 2026 03:04
@swananan swananan changed the title [WIP]feat: add gossip metrics benchmarks and CI integration feat: add gossip metrics benchmarks and CI integration Mar 29, 2026
@chenyukang
Copy link
Copy Markdown
Collaborator

@swananan is this PR ready to be merged?
or do you want to continue to work on the optimization on this branch.

@swananan
Copy link
Copy Markdown
Contributor Author

swananan commented Apr 1, 2026

@swananan is this PR ready to be merged? or do you want to continue to work on the optimization on this branch.

This PR is ready for review. The main thing I’d still like to discuss is the metrics data design, but if that looks good, I’d be happy to merge this PR and continue the optimization work on a separate branch.

Comment thread crates/fiber-lib/src/fiber/gossip.rs
Comment thread tests/perf/src/lib.rs Outdated
Comment thread tests/perf/src/lib.rs Outdated
Comment thread tests/perf/src/main.rs
Comment thread crates/fiber-lib/src/fiber/gossip.rs
@chenyukang
Copy link
Copy Markdown
Collaborator

@quake
This PR adds baseline observability and benchmark coverage for Fiber gossip before optimization work.

I think it's ok to be merge (some trivial comments), you can also take a review.

@swananan swananan force-pushed the feat/gossip-metrics-bench-ci branch from 47264fe to 4c73ce4 Compare April 5, 2026 19:29
@swananan swananan requested a review from chenyukang April 6, 2026 05:14
Comment thread .gitignore Outdated
Comment thread crates/fiber-lib/src/fiber/gossip.rs Outdated
@quake
Copy link
Copy Markdown
Member

quake commented Apr 10, 2026

@quake This PR adds baseline observability and benchmark coverage for Fiber gossip before optimization work.

I think it's ok to be merge (some trivial comments), you can also take a review.

lgtm, only two trivial comments from my side.

@swananan swananan force-pushed the feat/gossip-metrics-bench-ci branch from aa0a271 to a6484b1 Compare April 12, 2026 03:05
@quake quake merged commit cc02805 into nervosnetwork:develop Apr 14, 2026
39 checks passed
@chenyukang
Copy link
Copy Markdown
Collaborator

link #1263, since this PR may have effect on gossip benchmarks.

quake added a commit that referenced this pull request Apr 15, 2026
* fix: push limit to DB layer in list_payments to avoid unbounded memory usage (#1261)

* fix: push limit to DB layer in list_payments to avoid unbounded memory usage

get_payment_sessions_with_limit previously called collect_by_prefix
without a limit, loading ALL payment session KV pairs into memory
before applying .filter_map().take(limit) as iterator adapters.

Add PrefixIterator::new_from() for cursor-based lazy iteration, and
prefix_iter/prefix_iter_from helpers to FiberStore trait. Rewrite
get_payment_sessions_with_limit as a simple iterator chain using the
lazy batched PrefixIterator, which fetches only 100 entries at a time
and stops as soon as enough results are collected.

* Update crates/fiber-store/src/iterator.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* feat: update macOS build configuration for portability (#1237)

* feat: update macOS build configuration for portability

* refactor: simplify macOS build steps by removing Homebrew setup

* renaming for keep portable

* feat: add official Docker image support (#1244)

* feat: add official Docker image support

* ci: publish docker images to ghcr and docker hub

* fix docker image readme

* Bump fiber-rpc-gen to 0.1.22 (#1264)

* network: onion & socks5 support for fiber (#1228)

* onion & socks5 support for fiber

* make CI happy

* Add default configuration

* fix tor service

* use nested structure for onion and proxy config

* send MaintainConnections message to NetworkActor when tor is reconnected

* make fmt happy

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix some issues pointed out by copilot

* fix openroc-json-generator

* update ckb-testtool

* update cargo.lock

* merge newest changes

* fix a race condition in onion service start

* make fmt happy

* Update crates/fiber-lib/src/fiber/onion_service.rs

Co-authored-by: Eval Exec <execvy@gmail.com>

* Change default onion external port

* update

* update .gitignore

* isolate wasm configuration related to proxy and tor

* add timeout check for start_onion_service & retry in `OnionService::start`

* Added 3-second delay before sending MaintainConnections

* move `proxy` and `onion` related configurations to their individual modules

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Eval Exec <execvy@gmail.com>

* Fix fnn-migrate error messages and update README (#1249)

* Initial plan

* fix: update fnn-migrate flag from -p to -d in error message and README

Agent-Logs-Url: https://github.com/gpBlockchain/fiber/sessions/a6b4f2a5-59de-4e8b-a07f-a3ffb49b7a48

Co-authored-by: gpBlockchain <32102187+gpBlockchain@users.noreply.github.com>

* fix: show fiber data directory (without /store) in fnn-migrate error message

Agent-Logs-Url: https://github.com/gpBlockchain/fiber/sessions/0de95c55-8af8-4a5c-b2f7-98b4c62c35b2

Co-authored-by: gpBlockchain <32102187+gpBlockchain@users.noreply.github.com>

* Apply suggestion from @gpBlockchain

* Apply suggestion from @gpBlockchain

* Apply suggestion from @gpBlockchain

* Update crates/fiber-store/src/db_migrate.rs

Co-authored-by: gpBlockchain <32102187+gpBlockchain@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Quake Wang <quake.wang@gmail.com>

* chore(deps): bump tokio from 1.50.0 to 1.51.1

Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.50.0 to 1.51.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](tokio-rs/tokio@tokio-1.50.0...tokio-1.51.1)

---
updated-dependencies:
- dependency-name: tokio
  dependency-version: 1.51.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* docs: refresh public node and network node documentation (#1266)

* rename testnet-nodes.md and add network-nodes.md

* docs: update README network node links

* docs: refine pubkey-based node docs

* docs: clarify node2 rpc discovery in public nodes guide

* fix: abort funding on insufficient UDT cells (#1195) (#1253)

When UDT cells are not yet indexed, the funding transaction builder
would fail with a generic TxBuilderError that was silently swallowed
(empty tx logged and ignored). This left UDT channels permanently
stuck in the negotiating state.

- Add FundingError::InsufficientCells variant that is non-temporary,
  so schedule_funding_retry aborts the channel instead of retrying
- Reclassify AbsentTx as temporary so empty funding results get
  retried via the existing backoff mechanism
- Extract map_tx_builder_error to convert the sentinel UDT message
  into InsufficientCells before it reaches the retry logic
- Move FundingError tests to dedicated tests/error.rs module and add
  coverage for the new error mapping and classification

Co-authored-by: ian <ian@cryptape.com>

* feat: add gossip metrics benchmarks and CI integration (#1177)

* feat: add gossip metrics benchmarks and CI integration

- add gossip protocol metrics counters/histograms and active-sync/query observability

- add criterion gossip benchmarks for multi-node propagation and sync-recovery

- add tests/perf gossip benchmark flows driven by metrics (steady/burst + baseline/compare)

- integrate benchmark CI with metrics-enabled startup and bootstrap gossip regression gating

* fix: stabilize gossip benchmark runs and move gossip perf to dedicated workflow

* chore: ignore generated gossip perf benchmark artifacts

* fix: tighten gossip duplicate/rejected metrics and perf timing

* ci: move perf benchmark artifacts under tests/perf/artifacts

* refactor: move gossip metrics helpers into dedicated modules

* chore(deps): bump rand from 0.8.5 to 0.9.3 in /tests/deploy/udt-init

Bumps [rand](https://github.com/rust-random/rand) from 0.8.5 to 0.9.3.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/0.9.3/CHANGELOG.md)
- [Commits](rust-random/rand@0.8.5...0.9.3)

---
updated-dependencies:
- dependency-name: rand
  dependency-version: 0.9.3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Trigger gossip sync immediately on peer connection (#1271)

* Trigger gossip sync immediately on peer connection

Send TickNetworkMaintenance to self when a new peer connects, eliminating
the initial 0-60s wait before gossip data sync begins. This is critical
for WASM nodes that need peer address data from gossip shortly after
connecting to a bootnode.

Fixes: #1269

* Fix gossip tick race: gate on control.is_some(), defer from ReceivedControl

Agent-Logs-Url: https://github.com/nervosnetwork/fiber/sessions/5c445ccc-f1ef-4a6d-96aa-4254471fffb9

Co-authored-by: quake <8990+quake@users.noreply.github.com>

* Add regression test for immediate gossip sync on peer connect

Agent-Logs-Url: https://github.com/nervosnetwork/fiber/sessions/42d6ab86-ae76-47da-8ccd-b535b89f7be1

Co-authored-by: quake <8990+quake@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: quake <8990+quake@users.noreply.github.com>

* feat: add addr_type parameter to connect_peer RPC for transport type filtering (#1270)

* feat: add addr_type parameter to connect_peer RPC for transport type filtering

When connect_peer is called with only a pubkey, the node randomly selects
an address from the peer's known addresses. In WASM environments, this may
select a non-WSS address that is unsupported. Add an optional addr_type
parameter (tcp/ws/wss) to allow callers to filter addresses by transport
type before random selection.

* refactor: decouple actor protocol from JSON types and improve error messages

- Introduce MultiAddrTransport enum in fiber-types as the internal
  transport filter type, keeping fiber-json-types::MultiAddrType as the
  RPC-facing type only
- Add From<MultiAddrType> for MultiAddrTransport conversion in
  fiber-json-types convert.rs (behind conversion feature)
- Update NetworkActorCommand::ConnectPeerWithPubkey to use
  MultiAddrTransport instead of fiber_json_types::MultiAddrType
- Convert at the RPC boundary in rpc/peer.rs via .map(Into::into)
- Add NoMatchingAddress(Pubkey, MultiAddrTransport) error variant to
  distinguish 'peer not found' from 'peer has no addresses matching
  the requested transport type'
- Rename matches_addr_type -> matches_addr_transport for clarity

* refactor: use tentacle::utils::TransportType and rename MultiAddrType

Per review: reuse the existing tentacle::utils::TransportType instead
of introducing a custom MultiAddrTransport in fiber-types.

- Remove MultiAddrTransport enum and Display impl from fiber-types
- Remove From<MultiAddrType> conversion from fiber-json-types/convert.rs
- Rename MultiAddrType -> TransportType in fiber-json-types/peer.rs
- Update NetworkActorCommand::ConnectPeerWithPubkey to use
  tentacle::utils::TransportType directly
- Remove cfg(not(wasm32)) gate from TransportType import and find_type()
  (both are available on all targets in tentacle)
- Replace matches_addr_transport() with find_type() == transport
- Add to_transport_type() conversion in rpc/peer.rs at the RPC boundary
- Update NoMatchingAddress error to use tentacle::utils::TransportType
- Update TypeScript types and regenerate RPC docs

* fix: allow DNS-based WSS addresses to pass the private address filter

The private address filter used multiaddr_to_socketaddr() which only
handles Ip4/Ip6 protocols, silently dropping DNS-based addresses like
/dns4/example.com/tcp/443/wss. This prevented WSS addresses from being
broadcast in node announcements.

Add is_addr_reachable() helper that treats Dns4/Dns6 addresses as
always reachable (since DNS implies a public endpoint), while preserving
the existing IP-based reachability check. Applied at all three filter
locations: announcement creation, graph ingestion, and gossip processing.

* feat(cch): default final TLC expiry deltas to 60 hours (#1258)

* feat(cch): default final TLC expiry deltas to 60 hours

Raise DEFAULT_BTC_FINAL_TLC_EXPIRY_DELTA_BLOCKS to 360 (~10 min/block)
and DEFAULT_CKB_FINAL_TLC_EXPIRY_DELTA_SECONDS to 216,000. Update CCH
actor tests that assumed the previous 30h defaults.

Made-with: Cursor

* test(cch): replace expiry magic numbers with named constants

Use BTC_BLOCK_TIME_SECS, DEFAULT_BTC_FINAL_TLC_EXPIRY_DELTA_BLOCKS,
DEFAULT_CKB_FINAL_TLC_EXPIRY_DELTA_SECONDS, and per-test scenario consts
in CCH actor tests.

Made-with: Cursor

---------

Co-authored-by: ian <ian@cryptape.com>

* Local RPC method not found should not return unauthorized (#1235)

* chore: bump version to v0.8.1 (#1274)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Yukang <moorekang@gmail.com>
Co-authored-by: Officeyutong <yt.xyxx@gmail.com>
Co-authored-by: Eval Exec <execvy@gmail.com>
Co-authored-by: gpBlockchain <32102187+gpBlockchain@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: sunchengzhu <36075573+sunchengzhu@users.noreply.github.com>
Co-authored-by: ian <me@iany.me>
Co-authored-by: ian <ian@cryptape.com>
Co-authored-by: swananan <jt26wzz@gmail.com>
Co-authored-by: quake <8990+quake@users.noreply.github.com>
Co-authored-by: jjy <jjyruby@gmail.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.

3 participants