Add fee stats RPC#1201
Conversation
0a7be53 to
a78adad
Compare
6260f35 to
0cc1451
Compare
0cc1451 to
77251dd
Compare
There was a problem hiding this comment.
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/PaymentEventdata models, new store prefixes, and aChannelEventStorepersistence/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. |
d9af5c9 to
2720387
Compare
|
Is this a stacked PR? It contains a lot of code for cli. |
it's show old commits because of |
2720387 to
949b6e7
Compare
jjyr
left a comment
There was a problem hiding this comment.
There are more udt_type_script need to be removed
6d5dca0#diff-b054a8c2ec1de8d12c279e1ab6380f06340012773cb05f3c8e96e0fae6273cb6R262
removed with new commit. |
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.