Skip to content

Add fee stats RPC#1201

Open
chenyukang wants to merge 13 commits intonervosnetwork:developfrom
chenyukang:yukang-add-fee-stats
Open

Add fee stats RPC#1201
chenyukang wants to merge 13 commits intonervosnetwork:developfrom
chenyukang:yukang-add-fee-stats

Conversation

@chenyukang
Copy link
Copy Markdown
Collaborator

  • fee_report: Returns a summary of forwarding fees earned over day/week/month windows,
    grouped by asset type (CKB and each UDT).

  • forwarding_history: Returns individual forwarding events with optional time range, asset filter, and pagination.

@chenyukang chenyukang changed the title Add fee stats Add fee stats RPC Mar 14, 2026
@chenyukang chenyukang force-pushed the yukang-add-fee-stats branch from 0a7be53 to a78adad Compare March 14, 2026 01:04
@chenyukang chenyukang force-pushed the yukang-add-fee-stats branch 2 times, most recently from 6260f35 to 0cc1451 Compare March 14, 2026 04:04
@chenyukang chenyukang force-pushed the yukang-add-fee-stats branch from 0cc1451 to 77251dd Compare March 14, 2026 04:25
@quake quake added this to the v0.8 milestone Mar 16, 2026
@quake quake requested review from Copilot, jjyr and quake March 17, 2026 01:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds fee/payment statistics and history reporting to the Fiber node by persisting forwarding/payment events and exposing new Info-module JSON-RPC methods (plus WASM + CLI surface updates).

Changes:

  • Introduces ForwardingEvent / PaymentEvent data models, new store prefixes, and a ChannelEventStore persistence/query trait with RocksDB implementation and tests.
  • Adds Info RPC methods: fee_report, forwarding_history, sent_payment_report, received_payment_report, payment_history, along with JSON types and generated RPC docs.
  • Wires new RPCs into authorization (biscuit rules) and the WASM wrapper.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
crates/fiber-wasm/src/lib.rs Passes store into InfoRpcServerImpl constructor for new event-backed RPCs.
crates/fiber-wasm/src/api.rs Extends WASM wrapper generics to include ChannelEventStore for Info RPC.
crates/fiber-types/src/schema.rs Adds store key prefixes for forwarding/payment event namespaces.
crates/fiber-types/src/channel.rs Defines ForwardingEvent, PaymentEventType, and PaymentEvent persisted models.
crates/fiber-lib/src/store/tests/store.rs Adds RocksDB round-trip tests for forwarding/payment event insert/query behavior.
crates/fiber-lib/src/store/store_impl/mod.rs Implements event key/value storage and ChannelEventStore for Store.
crates/fiber-lib/src/store/.schema.json Registers schema hashes for new persisted types.
crates/fiber-lib/src/rpc/mod.rs Extends server store bounds and wires Info RPC constructor with store.
crates/fiber-lib/src/rpc/info.rs Implements new fee/payment report + history RPC methods and core logic helpers.
crates/fiber-lib/src/rpc/biscuit.rs Adds auth rules for the new Info RPC methods.
crates/fiber-lib/src/rpc/README.md Documents new RPC methods and adds new RPC types to generated docs.
crates/fiber-lib/src/lib.rs Minor formatting change (blank line) near timestamp helper.
crates/fiber-lib/src/fiber/tests/payment.rs Asserts PaymentEvent/ForwardingEvent persistence for payment flows.
crates/fiber-lib/src/fiber/tests/mod.rs Registers new fee RPC logic tests module (non-wasm).
crates/fiber-lib/src/fiber/tests/fee.rs Adds unit tests for report/history logic using an in-memory ChannelEventStore mock.
crates/fiber-lib/src/fiber/network.rs Extends network store bounds to include ChannelEventStore.
crates/fiber-lib/src/fiber/channel.rs Records forwarding/payment events on TLC fulfillment paths.
crates/fiber-json-types/src/lib.rs Exports new fee-related JSON-RPC types module.
crates/fiber-json-types/src/fee.rs Defines JSON-RPC request/response/types for fee/payment reports and histories.
crates/fiber-cli/src/tests.rs Adds CLI arg parsing tests for forwarding_history params.
Makefile Bumps migration-check version used by tooling target.

Comment thread crates/fiber-json-types/src/fee.rs Outdated
Comment thread crates/fiber-json-types/src/fee.rs Outdated
Comment thread crates/fiber-lib/src/rpc/README.md Outdated
Comment thread crates/fiber-lib/src/store/store_impl/mod.rs Outdated
Comment thread crates/fiber-lib/src/store/store_impl/mod.rs
Comment thread crates/fiber-lib/src/fiber/channel.rs Outdated
Comment thread crates/fiber-types/src/schema.rs Outdated
Comment thread crates/fiber-lib/src/rpc/README.md Outdated
Comment thread crates/fiber-lib/src/rpc/info.rs Outdated
Comment thread crates/fiber-lib/src/rpc/info.rs Outdated
@chenyukang chenyukang force-pushed the yukang-add-fee-stats branch from d9af5c9 to 2720387 Compare March 17, 2026 04:16
Comment thread crates/fiber-cli/src/tests.rs Outdated
@doitian
Copy link
Copy Markdown
Member

doitian commented Mar 17, 2026

Is this a stacked PR? It contains a lot of code for cli.

@chenyukang
Copy link
Copy Markdown
Collaborator Author

Is this a stacked PR? It contains a lot of code for cli.

it's show old commits because of git merge.

@chenyukang chenyukang force-pushed the yukang-add-fee-stats branch from 2720387 to 949b6e7 Compare March 17, 2026 05:15
@quake quake removed this from the v0.8 milestone Mar 24, 2026
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.

4 participants