Skip to content
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

mobile: v2 implementation #704

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

mobile: v2 implementation #704

wants to merge 1 commit into from

Conversation

djkazic
Copy link
Contributor

@djkazic djkazic commented Jan 15, 2024

Here's an initial implementation of mobile-v2, which will replace #526. This is distinguished from the initial mobile branch proof of concept by:

  • Usage of the litd proxy to route requests to subservers
  • New terminal entrypoint instead of duplicated logic in bindings.go

There needs to be a refactor and some review around this code, so I am opening it as a draft PR.

Note: java protoc code generation was not compiling for loop.proto, seems like the deprecated field id may be causing protoc to create conflicting implementations of getIdBytes() between the new and old id types. Removing the deprecated id fields in SwapResponse and SwapStatus fixes the issue.

@dstadulis
Copy link

CC @kaloudis

terminal.go Outdated Show resolved Hide resolved
@djkazic djkazic force-pushed the mobile-v2 branch 3 times, most recently from 85934cd to 361eac3 Compare January 15, 2024 20:29
@djkazic djkazic changed the title Initial mobilev2 implementation (needs refactor) mobile: v2 implementation Jan 15, 2024
@djkazic djkazic marked this pull request as ready for review January 15, 2024 21:10
@djkazic djkazic requested a review from kaloudis January 15, 2024 21:11
@djkazic
Copy link
Contributor Author

djkazic commented Jan 15, 2024

Coming soon: glue code for loop/pool/tapd for proper dialing

@djkazic djkazic force-pushed the mobile-v2 branch 5 times, most recently from fb1770f to 008008a Compare January 16, 2024 15:14
@guggero guggero removed their request for review February 13, 2024 15:44
@kaloudis
Copy link

kaloudis commented Mar 4, 2024

Is there the ability to build the package with select subservices, and not others (eg. build w/ Taproot Assets and Loop, but not Pool)? If so, it's not documented in the README

@guggero
Copy link
Member

guggero commented Mar 4, 2024

No, not yet. For that we'd need to put a bunch of configuration code behind build flags.

@Roasbeef
Copy link
Member

Roasbeef commented Mar 5, 2024

@kaloudis have you been able to integrate this PR as is?

@kaloudis
Copy link

Was having some issues building but with Kevin's help was able to build for Android and iOS. Need to set Docker file sharing implementation to gRPC FUSE if using macOS

related: https://stackoverflow.com/questions/77256594/getting-sed-couldnt-open-temporary-file-permission-denied-error-in-docker-sc

@kaloudis
Copy link

kaloudis commented Mar 16, 2024

Next up for the Zeus POC is to find a way to add LNC and Speedloader calls to the exposed methods. Tried to simply replace the LND dependency in the go.mod with replace github.com/lightningnetwork/lnd => github.com/ZeusLN/lnd v0.17.4-beta-zeus.1 but that didn't do the trick.

Will try to pull them into lightning-terminal directly

@kaloudis
Copy link

Was able to build lightning-terminal mobile with Speedloader and LNC added to it. Working on a POC with Tapas in ZEUS next.

@johnanisere
Copy link

Hi @djkazic, I'm running this PR in integrated mode on IOS.

When I make requests to tapd, I always get Error: rpc error: code = Unknown desc = invalid macaroon: verification failed: signature mismatch after caveat verification

But requests to Lnd works fine.

this is what my conf file looks like

# Application Options
lnd-mode=integrated
network=testnet
uipassword=password
faraday-mode=remote
loop-mode=remote
pool-mode=remote

# Lnd
lnd.debuglevel=info
lnd.maxbackoff=2s
lnd.nolisten=1
lnd.norest=1


# Lnd - bitcoin
lnd.bitcoin.active=1
lnd.bitcoin.testnet=1
lnd.bitcoin.node=neutrino

# Lnd - Neutrino
lnd.neutrino.addpeer=btcd-testnet.lightning.computer
lnd.neutrino.feeurl=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json

# Lnd - Autopilot
lnd.autopilot.active=1
lnd.autopilot.private=1
lnd.autopilot.minconfs=1
lnd.autopilot.conftarget=16
lnd.autopilot.allocation=0.5
lnd.autopilot.heuristic=externalscore:0.95
lnd.autopilot.heuristic=preferential:0.05

# Lnd - Routing
lnd.routing.assumechanvalid=1

What could be wrong ?

@djkazic
Copy link
Contributor Author

djkazic commented Apr 17, 2024

I've seen that before when using the wrong macaroon.

@djkazic
Copy link
Contributor Author

djkazic commented Apr 17, 2024

I can drop the changes needed to fix this in a commit, one sec.

@johnanisere
Copy link

Hi @djkazic , I can't find the taproot assets api for subscribing to receive events for incoming asset transfers (https://lightning.engineering/api-docs/api/taproot-assets/taproot-assets/subscribe-receive-events) in the IOS framework generated.
I can see the one for subscribing to send events though. Is this intentional?

@djkazic
Copy link
Contributor Author

djkazic commented Apr 17, 2024

This is likely a proto file issue. Looking into this now.

@djkazic
Copy link
Contributor Author

djkazic commented Apr 17, 2024

Force pushed the latest proto files. Should be working now.

@johnanisere
Copy link

Thanks @djkazic , now I get these errors when I run make ios

/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:190:27: undefined: assetwalletrpc.CommitVirtualPsbtsRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:202:30: undefined: assetwalletrpc.CommitVirtualPsbtsRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:203:18: client.CommitVirtualPsbts undefined (type assetwalletrpc.AssetWalletClient has no field or method CommitVirtualPsbts)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:219:27: undefined: assetwalletrpc.PublishAndLogRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:231:30: undefined: assetwalletrpc.PublishAndLogRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:232:18: client.PublishAndLogTransfer undefined (type assetwalletrpc.AssetWalletClient has no field or method PublishAndLogTransfer)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:304:27: undefined: assetwalletrpc.QueryInternalKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:316:30: undefined: assetwalletrpc.QueryInternalKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:317:18: client.QueryInternalKey undefined (type assetwalletrpc.AssetWalletClient has no field or method QueryInternalKey)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:331:27: undefined: assetwalletrpc.QueryScriptKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:331:27: too many errors
# github.com/lightninglabs/lightning-terminal/mobile
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:190:27: undefined: assetwalletrpc.CommitVirtualPsbtsRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:202:30: undefined: assetwalletrpc.CommitVirtualPsbtsRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:203:18: client.CommitVirtualPsbts undefined (type assetwalletrpc.AssetWalletClient has no field or method CommitVirtualPsbts)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:219:27: undefined: assetwalletrpc.PublishAndLogRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:231:30: undefined: assetwalletrpc.PublishAndLogRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:232:18: client.PublishAndLogTransfer undefined (type assetwalletrpc.AssetWalletClient has no field or method PublishAndLogTransfer)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:304:27: undefined: assetwalletrpc.QueryInternalKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:316:30: undefined: assetwalletrpc.QueryInternalKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:317:18: client.QueryInternalKey undefined (type assetwalletrpc.AssetWalletClient has no field or method QueryInternalKey)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:331:27: undefined: assetwalletrpc.QueryScriptKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:331:27: too many errors
# github.com/lightninglabs/lightning-terminal/mobile
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:190:27: undefined: assetwalletrpc.CommitVirtualPsbtsRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:202:30: undefined: assetwalletrpc.CommitVirtualPsbtsRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:203:18: client.CommitVirtualPsbts undefined (type assetwalletrpc.AssetWalletClient has no field or method CommitVirtualPsbts)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:219:27: undefined: assetwalletrpc.PublishAndLogRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:231:30: undefined: assetwalletrpc.PublishAndLogRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:232:18: client.PublishAndLogTransfer undefined (type assetwalletrpc.AssetWalletClient has no field or method PublishAndLogTransfer)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:304:27: undefined: assetwalletrpc.QueryInternalKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:316:30: undefined: assetwalletrpc.QueryInternalKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:317:18: client.QueryInternalKey undefined (type assetwalletrpc.AssetWalletClient has no field or method QueryInternalKey)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:331:27: undefined: assetwalletrpc.QueryScriptKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:331:27: too many errors
/Users/johnanisere/go/bin/gomobile: ios/arm64: go build -tags mobile,-s,-w,-buildid=,-X,github.com/lightningnetwork/lnd/build.Commit=lightning-terminal-v0.12.2-alpha-23-g447a9fb066c5dfd8380417e96f3c0843d7e45d7e,-X,github.com/lightningnetwork/lnd/build.CommitHash=447a9fb066c5dfd8380417e96f3c0843d7e45d7e,-X,github.com/lightningnetwork/lnd/build.GoVersion=,-X,github.com/lightningnetwork/lnd/build.RawTags=litd,autopilotrpc,signrpc,walletrpc,chainrpc,invoicesrpc,watchtowerrpc,neutrinorpc,peersrpc,-X,github.com/lightninglabs/lightning-terminal.appFilesPrefix=,-X,github.com/lightninglabs/lightning-terminal.Commit=v0.12.2-alpha-23-g447a9fb066c5dfd8380417e96f3c0843d7e45d7e,-X,github.com/lightninglabs/loop.Commit=v0.26.6-beta,-X,github.com/lightninglabs/pool.Commit=v0.6.4-beta.0.20231003174306-80d8854a0c4b,-X,github.com/lightninglabs/taproot-assets.Commit=v0.3.2 -v -buildmode=c-archive -o /var/folders/t5/styjmbqd34q6f9pt1gnk_np00000gn/T/gomobile-work-622384700/Litdmobile-ios-arm64.a ./gobind failed: exit status 1

make: *** [ios] Error 1```

@djkazic
Copy link
Contributor Author

djkazic commented Apr 17, 2024

OK so the fundamental issue is that bumping the proto file like that without bumping the dependency is a chicken or egg problem.

@johnanisere we are blocked until taproot-assets cuts a new release. That functionality you described is newer than the latest release (0.3.3). cc @Roasbeef

@djkazic
Copy link
Contributor Author

djkazic commented Apr 17, 2024

I'll push a revert of the proto files for now.

@djkazic
Copy link
Contributor Author

djkazic commented Apr 17, 2024

OK revert pushed.

@johnanisere
Copy link

Alright, Got it @djkazic

@johnanisere
Copy link

Hi @djkazic, I noticed that all requests to Lnd fail until it's fully synced to the chain.
Request to GetInfo also fails, which makes it difficult to calculate sync progress.

Screenshot 2024-04-24 at 19 40 15

@djkazic
Copy link
Contributor Author

djkazic commented Apr 24, 2024

I believe that is due to lnd still starting up. Rpc active does not mean it is done. Server active status is needed for rpc requests to be routed.

@johnanisere
Copy link

johnanisere commented May 23, 2024

Hi @djkazic ,

There seem to be something wrong with tor setup of Litdmobile.
when ever i run Litdmobile with the tor config below, I get this error :
could not load config: ValidateConfig: listening must be enabled when enabling inbound connections over Tor.

Here is what my config file looks like

# Application Options
lnd-mode=integrated
network=testnet
uipassword=password
faraday-mode=remote
loop-mode=remote
pool-mode=remote

# Lnd
lnd.debuglevel=info
lnd.maxbackoff=2s
lnd.nolisten=1
lnd.norest=1


# Lnd - bitcoin
lnd.bitcoin.active=1
lnd.bitcoin.testnet=1
lnd.bitcoin.node=neutrino

# Lnd - Neutrino
lnd.neutrino.addpeer=btcd-testnet.lightning.computer
lnd.neutrino.feeurl=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json

# Lnd - Autopilot
lnd.autopilot.active=1
lnd.autopilot.private=1
lnd.autopilot.minconfs=1
lnd.autopilot.conftarget=16
lnd.autopilot.allocation=1
lnd.autopilot.heuristic=externalscore:0.95
lnd.autopilot.heuristic=preferential:0.05

# Lnd - Routing
lnd.routing.assumechanvalid=1

# Lnd - Tor
lnd.tor.socks=127.0.0.1:9050
lnd.tor.control=127.0.0.1:9051
lnd.tor.active=1
lnd.tor.v3=1
lnd.tor.password=somepassword
lnd.listen=localhost

What am i doing wrong?

@djkazic
Copy link
Contributor Author

djkazic commented May 23, 2024

@johnanisere
Copy link

@lightninglabs-deploy
Copy link

@Roasbeef: review reminder
@kaloudis: review reminder
@ViktorTigerstrom: review reminder

@lightninglabs-deploy
Copy link

Closing due to inactivity

9 similar comments
@lightninglabs-deploy
Copy link

Closing due to inactivity

@lightninglabs-deploy
Copy link

Closing due to inactivity

@lightninglabs-deploy
Copy link

Closing due to inactivity

@lightninglabs-deploy
Copy link

Closing due to inactivity

@lightninglabs-deploy
Copy link

Closing due to inactivity

@lightninglabs-deploy
Copy link

Closing due to inactivity

@lightninglabs-deploy
Copy link

Closing due to inactivity

@lightninglabs-deploy
Copy link

Closing due to inactivity

@lightninglabs-deploy
Copy link

Closing due to inactivity

@guggero
Copy link
Member

guggero commented Nov 19, 2024

!lightninglabs-deploy mute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 💇‍♂️Needs Shaping
Development

Successfully merging this pull request may close these issues.

7 participants