ipc: add NodeRpc interface for LND#42
Conversation
|
IWYU can be run locally with: You may want to change the make jobs to j16 or whatever matches your physical cores. I have this script locally to run clang tidy: |
| Input&& input, | ||
| ReadDest&& read_dest, | ||
| typename std::enable_if<std::is_floating_point<LocalType>::value>::type* enable = 0) | ||
| typename std::enable_if<std::is_floating_point<LocalType>::value>::type* enable = nullptr) |
There was a problem hiding this comment.
Ideally this gets upstreamed in the libmultiprocess subtree
There was a problem hiding this comment.
|
Fuzz job was canceled, not an actual fuzz failure, so unrelated to this PR |
91a951f tidy fix: modernize-use-nullptr (ViniciusCestarii) Pull request description: Prevent warning --modernize-use-nullptr when using clang-tidy on downstream projects (Noticed when pushing 2140-dev/bitcoin#42, this change was also necessary for bitcoin/bitcoin#29409 so CI doens't error) Top commit has no ACKs. Tree-SHA512: c99b999eea0d4e95a89d48dddd1ee9a7cab59eba76a83da363563ea6af89ec28278aef594b72584222db5129a4cbad42097e9b595690412f87acb0c90bf29652
|
This is nice. It would be nice if you could also vibe code an e2e demonstration of usage of this with LND. |
a side note: middleware for the IPC<>RPC communication might be needed |
|
As more of a conceptual question: is implementing a per method map what we want to do? I haven't looked at the code but just judging by the commit messages that seems to be the approach here. What I had in my head (shower thought, so not at all sure if its reasonable/possible/a good idea/etc) is something where this node maintains generic IPC interfaces (there are already a few upstream PRs for an IPC chain interface, for example). Then these generic interfaces are consumed by a bridging process. In that process is where the code for constructing the RPC calls lives and it is turned into what the downstream consumer wishes to consume (REST, JSON-RPC, Capnproto, ZMQ, etc). Ideally these would even live in their own repo, i.e., a 2140-dev/bridges, or even better the consumer's repo! As currently written, I'm not super stoked about this approach because it feels like "swap json rpc with capnproto." @ViniciusCestarii really appreciate you exploring the work, however! Would you be interested in exploring the design I just described? If so, I'd recommend starting with the Bitcoin Core IPC interfaces currently proposed to see if that sparks any ideas. This is not a suggestion to map them over to here, however, unless they make sense. Those interfaces were largely designed with legacy compatibility in mind, whereas we can take a fresh look here. Once you have a proposal for a more generic interface, then I'd suggest writing a bridge (bonus, you can write it in whatever language you want), and if it all looks good we can look into adding it to a bridges repo and looking at ways to package the node + bridges. |
|
bit of a tangent but FWIW i have a branch here dropping libmultiprocess, and using native capnp for a few interfaces here in case it’s of interest: bitcoin/bitcoin@master...willcl-ark:bitcoin:drop-libmultiprocess i have not yet added the but whether you have libmiltiprocess or not, i think i agree with josie; the rough (clean) approach should be to expose clean, generic ipc methods. these are then consumed internally, and by things like zmq, rpc, rest, or directly via IPC connection/unix socket. |
|
After thinking through the discussion, I get the "this is just json-rpc with capnp" critique now, and I agree with it. My current approach maps the specific RPC methods LND needs directly onto the IPC interface. The problem is that this bakes one consumer's API shape into the node's wire interface permanently, and it doesn't actually prove anything about the architecture: of course it works, I designed the IPC methods to be exactly what LND wanted. It's circular. The more justifiable approach is to expose clean, generic capabilities on the node (a Chain capability, etc., close to what interfaces::Chain already provides internally), and put the consumer-specific logic in a separate bridge process that translates those capabilities into whatever a consumer wants (for LND, the bitcoind JSON-RPC + ZMQ shape) as @josibake suggested. Two reasons why I believe this is better:
This design seems more challenging but much more exciting! I appreciate all the feedback! |
|
@ViniciusCestarii thanks for taking the feedback! Given this is more of an open ended design question (with LND as the practical example), it might be worth opening a discussion for this or continuing the discussion on the already open issue. Once you have a design you are happy with, we can come back to the implementation in the PR. |
Closes #24
Add new IPC interface NodeRpc implementing methods necessary for LND.
I tried to mirror the necessary JSON-RPC methods so it is friendly to use and easier to follow up with an IPC translator.
I have implemented a simple C++ cli client for testing this new interface: https://github.com/ViniciusCestarii/bitcoin-ipc-demo/tree/2140-lnd-ipc
AI diclaimer: I used Claude Opus 4.8 to help converting the JSON-RPC methods to IPC.