Skip to content

Stateless integrated mode #278

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

Merged
merged 2 commits into from
Nov 23, 2021
Merged

Stateless integrated mode #278

merged 2 commits into from
Nov 23, 2021

Conversation

guggero
Copy link
Member

@guggero guggero commented Nov 4, 2021

Replaces #269.

I started reviewing #269 and noticed a few things that could be simplified.
Taking over the PR to speed things up and hopefully get this in with the next major LiT release that also includes lnd v0.14.0.

@guggero guggero mentioned this pull request Nov 4, 2021
@guggero
Copy link
Member Author

guggero commented Nov 4, 2021

I'm seeing a weird error in the grpc-web calls (grpc-message: failed proxying s2c: rpc error: code = Internal desc = grpc: error while marshaling: failed to marshal, message is *proxy.frame, want proto.Message) so this doesn't fully work yet, will hold off on requesting reviews.

@guggero guggero force-pushed the stateless-integrated-mode branch 2 times, most recently from 4f56a50 to fc99839 Compare November 5, 2021 11:06
@guggero guggero force-pushed the stateless-integrated-mode branch from fc99839 to 0f5c083 Compare November 9, 2021 17:14
@guggero guggero requested review from jamaljsr and Roasbeef November 9, 2021 17:15
@guggero
Copy link
Member Author

guggero commented Nov 9, 2021

I found and fixed the bug. Stateless integrated mode is now working, with the super macaroon 🎉 So this is ready for full review and test.

Again, big kudos to @orbitalturtle for tackling this huge multi-part project!

@guggero guggero linked an issue Nov 10, 2021 that may be closed by this pull request
5 tasks
Copy link
Member

@jamaljsr jamaljsr left a comment

Choose a reason for hiding this comment

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

LGTM 👍
The frontend is fully functional from my testing. The only confusion I have is regarding the missing macaroon files for loop, pool, and faraday. Are these intentionally removed? How do we talk to the nodes via CLI? I tried using the admin.macaroon in my .lnd dir but that didn't work.

@guggero
Copy link
Member Author

guggero commented Nov 18, 2021

Thank you for the review, @jamaljsr!

You are totally correct, those macaroons shouldn't be deleted. Only when the wallet is initialized as stateless (which is the whole purpose of this PR). So I added a commit that checks what state the wallet is in.

@jamaljsr
Copy link
Member

Just re-tested using commit 6700a2c but now im getting the error below.

bash-5.1# ls -al ~/.pool/regtest/
total 64
drwxr-xr-x    2 root     root          4096 Nov 18 14:05 .
drwxr-xr-x    4 root     root          4096 Nov 18 14:04 ..
-rw-------    1 root     root         32768 Nov 18 14:05 macaroons.db
-rw-------    1 root     root         32768 Nov 18 14:05 pool.db
-rw-r--r--    1 root     root           144 Nov 18 14:05 pool.macaroon

bash-5.1# pool --rpcserver=localhost:10009 --tlscertpath=/root/.lnd/tls.cert  --macaroonpath=/root/.pool/regtest/pool.macaroon accounts list
[pool] rpc error: code = Unknown desc = macaroon is not valid, returned false

bash-5.1# ls -al ~/.loop/regtest/
total 60
drwxr-xr-x    2 root     root          4096 Nov 18 14:05 .
drwxr-xr-x    4 root     root          4096 Nov 18 14:04 ..
-rw-------    1 root     root         32768 Nov 18 14:05 loop.db
-rw-r--r--    1 root     root           164 Nov 18 14:05 loop.macaroon
-rw-------    1 root     root         32768 Nov 18 14:05 macaroons.db

bash-5.1# loop --rpcserver=localhost:10009 --tlscertpath /root/.lnd/tls.cert  --macaroonpath /root/.loop/regtest/loop.macaroon terms
Loop Out
--------
rpc error: code = Unknown desc = macaroon is not valid, returned false

Loop In
------
rpc error: code = Unknown desc = macaroon is not valid, returned false
bash-5.1#

@guggero
Copy link
Member Author

guggero commented Nov 18, 2021

Thank you for testing! Oops. I know what the problem is, sorry I should've verified it myself first. Will fix tomorrow.

@guggero guggero force-pushed the stateless-integrated-mode branch from 6700a2c to 1a361f3 Compare November 23, 2021 14:17
orbitalturtle and others added 2 commits November 23, 2021 15:28
In integrated mode we hook directly into lnd's bufconn listener for any
connections to it. So we don't need any TLS setup and can bake a single
super macaroon that is used for all RPC calls.
In case the wallet was initialized in a stateless way, we don't want to
create the default macaroons for the faraday/loop/pool daemons. In any
other case we do so we can interact with the daemons through the CLI.
@guggero guggero force-pushed the stateless-integrated-mode branch from 1a361f3 to e84267c Compare November 23, 2021 14:28
@guggero guggero merged commit fda99a8 into master Nov 23, 2021
@guggero guggero deleted the stateless-integrated-mode branch November 23, 2021 14:33
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.

Add "stateless remote mode"
3 participants