Skip to content

implement LSPS5 #3499

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

johncantrell97
Copy link
Contributor

Implements LSPS5

I put it behind a feature flag because of the added dependencies of minreq and url. Alternatively, could rip these dependencies out and just have the liquidity crate surface an event to the LSP and have them make the http request themselves.

Has integration test that registers a webhook, lists them, and then asks to remove it.

TODO: Webhook notification message signing.

Copy link

codecov bot commented Dec 21, 2024

Codecov Report

Attention: Patch coverage is 36.36364% with 133 lines in your changes missing coverage. Please review.

Project coverage is 88.26%. Comparing base (463e432) to head (c6893d7).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
lightning-liquidity/src/lsps0/ser.rs 25.28% 126 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3499      +/-   ##
==========================================
- Coverage   88.34%   88.26%   -0.09%     
==========================================
  Files         149      149              
  Lines      112915   112991      +76     
  Branches   112915   112991      +76     
==========================================
- Hits        99753    99729      -24     
- Misses      10685    10770      +85     
- Partials     2477     2492      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

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

Ah, cool, thanks for looking into this! I have yet to properly review this, but here are a few first comments.

Generally, this a huge diff. I'd prefer to break this up over multiple PRs, e.g., adding persistence in a follow-up (preferably when we also worked out a common scheme across LSPS1/2/5). And, at the very least, please break this PR up into multiple logical commits rather than a single huge one. This would making reviewing it much easier. Thanks!

@@ -17,6 +17,7 @@ categories = ["cryptography::cryptocurrencies"]
default = ["std"]
std = ["lightning/std"]
backtrace = ["dep:backtrace"]
lsps5 = ["minreq", "url"]
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we'll want to add an HTTP client dependency here, especially since recently rustls bumped MSRV.

As send_webhook doesn't even return any data, we should be fine just creating an event variant for it and letting the service implement it however they want, no?

Feel free to convert the lsps5 feature to an lsps5 cfg-gate while you're here though, that would allow us to land this before we're sure LSPS5 is fully ready to be shipped.

@@ -0,0 +1 @@
//! Utilities for implementing the LSPS5 standard.
Copy link
Contributor

Choose a reason for hiding this comment

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

This file can just be dropped, no?

// You may not use this file except in accordance with one or both of these
// licenses.

//! Implementation of LSPS2: JIT Channel Negotiation specification.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: LSPS5, not LSPS2.

for app_name in registered_app_names.into_iter() {
let webhook_bytes = self
.kv_store
.read(WEBHOOK_PRIMARY_NAMESPACE, &counterparty_node_id.to_string(), &app_name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Mhh, how much data are we expecting here? Should all of the webhooks live under a single key (and in memory) rather then reading them on a per-peer basis from IO on-demand?

service_config: Option<LiquidityServiceConfig>,
_client_config: Option<LiquidityClientConfig>,
best_block: RwLock<Option<BestBlock>>,
_chain_source: Option<C>,
_kv_store: Option<KV>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Mhh, I'm generally not sure if persistence should be added in this PR, especially given that we still have to work out a common persistence scheme across LSPS1/2/5. At the very least this should be broken out to (a number of) different commits.

@johncantrell97
Copy link
Contributor Author

Thanks for the feedback. Will close this and break it up into much smaller, easier-to-review PR's instead.

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