-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add Initial Protobuf generation setup and initial protos for v1 api's. #2
Conversation
Ah, seems there was a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a first look, added a few comments.
I really think we should align at least the initial version of the API with LDK Node's API and copy over the LDK Node docs. This way, we'd be able to take advantage of the effort we already put in over there, in particular properly documenting potential caveats, etc.
Needs a minor rebase now. |
Most of it is that and we align with apis in ldk-node/ldk and want to refer to docs from ldk-node or ldk for details. Note that it is much easier to change apis for a library than it is for a service, we have lot of flexibility in both ldk/ldk-node to change/merge api's but we can't do that easily in ldk-node-server. Hence I kept most of the api as same but made some minor simplifications after referring to both lnd and clightning api. I think it makes sense to combine CloseChannel & ForceCloseChannel into 1 api. |
But if we really align the API for the first version, we could literally copy over the docs, do some minor modifications and be done with it, no? So it would save us a bunch of work re-writing and re-reviewing all the API docs?
Could you expand on why you think this is the case? How is a library materially different here?
I'm really really sceptical of this approach. Each implementation has their own idiosyncrasies and IMO we should strive to create the best API design we can come up with, and shouldn't unnecessarily restrict us by trying to match LND and/or CLN which have different technical scope and limitations. If you accommodate all the limitations of LDK (Node), CLN, and LND in the API design, you end up with the least common denominator, which is likely not a great outcome.
Well, we share the same design goals in LDK Node. Meaning, if we think we can find a more succinct API design that accommodates our users needs, the changes should also/first happen in LDK Node itself, not only in the server part.
No, there are good reasons why we kept them separate API methods in the first place, and in some cases they used to be combined methods and we refactored them to be separate. For close channel, you really want to avoid API misuse by have the user call two clearly distinct endpoints, as force closures are much more costly. For For |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The APIs look good, just some comments.
Will do a (final?) closer look at the docs next.
Do you mind cleaning up the commit history, grouping them in feature and fixup commits?
} | ||
#[allow(clippy::derive_partial_eq_without_eq)] | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct OnchainSendResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we also need error response types for all of these *Request
s, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, the best practices I've seen for protocol buffers is to use a single error response. https://cloud.google.com/apis/design/errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes will introduce an error type at once for all api's probably.
It needs some more thinking, hence i left it out as a separate task for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, while I think using a single error response might be most common, in Rust it might be more convenient to have separate types or at least enum
variants? So we may then want to have a single response type with the numerical error code, but then actually convert it (by implementing From
both ways?) to a well-defined error type that we use most places in Rust?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may then want to have a single response type with the numerical error code,
Yes, I envision something like that. Let us have this discussion once I am working on error handling, this PR isn't directly related to this. Will discuss some approaches before the error-handling part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, makes sense!
Do we want a tracking issue listing the planned upcoming PRs? Might make it easier to follow what will be added at which stage, but maybe also no big deal?
ebb42c7
to
8c6ce05
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I think.
To make some progress here and keep iterating I won't get into any doc nits for now, but I think we should proofread and make them more uniform in a single go once all of the MVP APIs have been added.
Could you interleave the fixups and squash them into their respective feature commits?
8c6ce05
to
941ed8c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to land this.
It would be nice if you could provide a diff if you make additional changes during squashing. Diff wasn't huge in this case, but makes reviewing the changes easier.
FYI, the Github "Compare" link next to the forced push item should give you a diff. It mostly works lol. |
Thanks, I'm aware of that link, but especially for repeated force-pushes GitHub likes to forget the diffs, so often it's not really reliable.. |
Api specification included in this PR: