schema: add notification schemas and generated bindings#8938
schema: add notification schemas and generated bindings#8938nepet wants to merge 7 commits intoElementsProject:masterfrom
Conversation
Add schema definitions for the documented native notifications which were still only described in prose. This makes the notification payloads available in doc/schemas so msggen can consume them in later commits, while keeping this commit schema-only. The balance_snapshot schema follows the current implementation shape: the notification wrapper contains a single balance_snapshot object whose accounts field is an array of account snapshots.
Add schema files for the documented xpay notifications using the temporary flat naming convention. These topics are plugin-emitted rather than native lightningd notifications, so keep them separate from msggen generation for now while still recording their subscriber-visible payload shape in doc/schemas.
Expand the native notification list consumed by msggen and regenerate the Rust and gRPC outputs for the documented notification schemas. This wires the new schema-backed native notifications through cln-rpc, cln-grpc, and the bundled msggen schema metadata. Keep the temporary xpay-prefixed plugin notifications out of generation for now. coin_movement.extra_tags remains a repeated string in the generated gRPC surface for now because msggen does not currently emit enums nested under repeated array items correctly. Changelog-Changed: cln-rpc and cln-grpc now expose notification bindings for balance_snapshot, coin_movement, deprecated_oneshot, disconnect, forward_event, invoice_creation, invoice_payment, log, onionmessage_forward_fail, openchannel_peer_sigs, plugin_started, plugin_stopped, sendpay_failure, sendpay_success, shutdown, and warning.
Treat xpay as a built-in plugin for notification generation and include its documented notification schemas in the msggen output. This extends the generated cln-rpc and cln-grpc notification surfaces with the flat xpay schema files, while exposing the actual notification names `pay_part_start` and `pay_part_end` in generated APIs. Changelog-Changed: cln-rpc and cln-grpc now expose xpay notification bindings for `pay_part_start` and `pay_part_end`.
Bump the Rust binding crates after adding new notification bindings, and roll pyln-grpc-proto because the published grpc surface changed with the regenerated node.proto. cln-plugin is unchanged because this branch does not alter its public API. Changelog-Changed: cln-rpc 0.5.1, cln-grpc 0.5.1, and pyln-grpc-proto 25.12 include the new notification bindings added in this series.
| "description": [ | ||
| "1-based index indicating order this move was created in." | ||
| ], | ||
| "added": "pre-v0.10.1" |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
No it's v25.09 if i'm not mistaken again: 6c626b1#diff-883a753be8d6ebb0fc9f54e5db4f93d2f2560cd27230fba18625984e6b77c3d4
| "in_msat", | ||
| "status", | ||
| "received_time" | ||
| ], |
There was a problem hiding this comment.
I'm pretty sure for a forward_event the payment_hash is required.
| "received_time" | ||
| ], | ||
| "properties": { | ||
| "created_index": { |
There was a problem hiding this comment.
created_index should be required aswell.
| "description": [ | ||
| "The **onionmessage_forward_fail** notification informs whenever lightningd cannot forward an onion message." | ||
| ], | ||
| "added": "v24.02", |
There was a problem hiding this comment.
this whole thing was added in v24.11, see CHANGELOG.md
| "description": [ | ||
| "The **openchannel_peer_sigs** notification informs whenever a peer provides signatures for an in-progress channel open." | ||
| ], | ||
| "added": "v24.02", |
There was a problem hiding this comment.
I believe this one is much older: daa55d1
So i would put "pre-v0.10.1"
| "description": [ | ||
| "The **plugin_started** notification informs whenever a plugin has started and registered its methods." | ||
| ], | ||
| "added": "v24.02", |
There was a problem hiding this comment.
This was added in v25.02, see CHANGELOG.md
| "description": [ | ||
| "The **plugin_stopped** notification informs whenever a plugin stops and exposes the same payload shape as **plugin_started**." | ||
| ], | ||
| "added": "v24.02", |
There was a problem hiding this comment.
This was added in v25.02, see CHANGELOG.md
|
I'm somewhat of a notification schemer myself, so i compared this PR with mine and hopefully combined we got it correct (surely !?). I think we should not bump versions in Cargo.toml's in this PR since it will trigger an automatic release to crates.io and i'd like to get some other changes in first. Unless you like to be last or nobody minds multiple version bumps in a short time period. Also CI will complain (check the diff in Also i think you should add the notification subscriptions in |
|
Another thing i just tested to confirm: The documentation and the code of |
|
I also noticed that our (ignore the assert diff) |
|
Very nice changes, just some minor issues that @daywalker90 pointed out ^^ |
Important
26.04 FREEZE March 11th: Non-bugfix PRs not ready by this date will wait for 26.06.
RC1 is scheduled on March 23rd
The final release is scheduled for April 15th.
Checklist
Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked:
tools/lightning-downgradeAdd JSON schemas for 18 notification topics (native and xpay), generate Rust and gRPC bindings from them via msggen, and include round-trip deserialization tests for the most complex types.