Commit graph

787 commits

Author SHA1 Message Date
Oliver Gugger
f460060692
wasm 2021-05-25 14:21:39 +02:00
Oliver Gugger
7af677a467
version: bump to v0.5.0-alpha 2021-05-19 14:29:19 +02:00
Oliver Gugger
6f5f67b943
mod: use latest tagged version of auctioneerrpc 2021-05-19 14:29:17 +02:00
Oliver Gugger
327b6a703d
multi: bump lnd to version v0.13.0-beta.rc2 2021-05-19 14:28:53 +02:00
Olaoluwa Osuntokun
a43019f246
Merge pull request #250 from lightninglabs/auto-sidecar
multi: implement automated negotiation for sidecar channels
2021-05-09 19:30:28 -07:00
Olaoluwa Osuntokun
3e41af988e
sidecar: move sidecar logic to new file, properly handle retransmission
In this commit, we move most of the sidecar logic to a new file, and
also tweak each of the main state machines to be able to properly handle
retransmission events by both sides. When the provider restarts, it'll
send over a plain offered ticket, which'll prompt the receiver to
re-send their registered ticket. When the receiver restarts, it'll
re-send its registered ticket, which'll prompt the provider to re-send
their ordered ticket.
2021-05-09 19:25:23 -07:00
Olaoluwa Osuntokun
42aec3fc8f
rpc: include order nonce in SidecarTicket
We add the order nonce as if automated negotiation was used, then the
order nonce (when it actually is submitted and its state) can be used to
track the ongoing sidecar ticket negotiation.
2021-05-09 19:25:18 -07:00
Olaoluwa Osuntokun
ba9a223bd6
sidecar: use a funciton closure for PrepareOrder
The RPC server won't be created by the time we attempt to reach for this
pointer, so we use a function closure to allow "lazy" evaluation which
only attempts to derf once the system is already up and running.
2021-05-09 19:25:16 -07:00
Olaoluwa Osuntokun
37947e5de5
cmd/pool: for sidecar offers parse complete bid if auto flag is set
Otherwise, we'll just parse out the 3 fields we actually need. Only if
the auto flag is set do we need to collect the complete bid as normal.
2021-05-09 19:25:13 -07:00
Olaoluwa Osuntokun
23b5144c47
cmd/pool: extract bid flags and parsing into new functions/variables
This sets us up to re-use these values in the next commit to parse out
the new complete set of fields that are required for a sidecar ticket.
2021-05-09 19:25:11 -07:00
Olaoluwa Osuntokun
4c1aac0338
sidecar: on start up, relaunch state machines for in progress auto tickets 2021-05-09 19:25:08 -07:00
Olaoluwa Osuntokun
05cb020997
rpc: add automated sidecar negotiation for the recipient
In this commit, we add automated sidecar negotiation for the recipient.
We'll use the new expose mailbox system to communicate with the provider
of the ticket to incrementally transform and complete it.

We add a new state machine attached to the sidecar acceptor that drives
the sidecar ticket to completion. We have two main states to handle:
sending the ticket w/ our node's information to the provider, and then
waiting for the final ticket from the provider that contains the order
information.

rpc: add automated ticket negotiation for the sidecar provider

In this commit, we add automated ticket negotiation for the sidecar
provider. The provider's state machine is a bit more involved as it
needs to do more in order to finalize the ticket. It starts by making a
new stream, and waiting for the recipient to send over the sidecar
information with their node information. From there it submits the bid,
checkpoints the state, and then adds the bid information before sending
the ticket back to the recipient.
2021-05-09 19:25:06 -07:00
Olaoluwa Osuntokun
2eb41fb90f
sidecar: modify RegisterSidecar to return modified ticket
In this commit we remove the mutation from `RegisterSidecar`. Rather
than modify the sidecar ticket, we instead accept a copy and return a
modified copy. This makes the control flow of future changes easier to
follow.
2021-05-09 19:25:04 -07:00
Olaoluwa Osuntokun
d0390b4c2c
server: add new config for sidecar acceptor 2021-05-09 19:25:02 -07:00
Olaoluwa Osuntokun
3c51afc65c
rpc: extract logic to validate and submit bids into new functions
This sets us up to re-use them later when we need to submit the bid once
we finish processing the sidecar ticket.
2021-05-09 19:25:00 -07:00
Olaoluwa Osuntokun
515a6ef476
clientdb: add new method to insert a sidecar ticket along w/ a bid
In this commit, we add a new method that lets us insert a sidecar ticket
as well as a bid in an atomic manner. We'll use this later when offering
this new type of automated ticket.
2021-05-09 19:24:58 -07:00
Olaoluwa Osuntokun
2dcc903495
sidecar: update ticket w/ new offer field to indicate auto negotiation 2021-05-09 19:24:56 -07:00
Olaoluwa Osuntokun
c9640659cc
funding: sign offered ticket w/ trader account key
This change allows us to later use a ticket as a means to authenticate
communication between the provider and the recipient of a sidecar
channel.
2021-05-09 19:24:54 -07:00
Olaoluwa Osuntokun
064ef461d2
poolrpc: modify OfferSidecarRequest to embed bid expose auto flag
In this commit, we modify the `OfferSidecarRequest` to instead embed the
entire bid order. This makes parsing on the command line a bit easier,
and sets us up for auto negotiation, as we'll need to have the entire
bid ahead of time so we can submit it during ticket negotiation.
2021-05-09 19:24:52 -07:00
Olaoluwa Osuntokun
d1eff48e83
auctioneer: extend client w/ HashMail stream related methods 2021-05-09 19:24:49 -07:00
Olaoluwa Osuntokun
7dc5efd8a1
auctioneerrpc: add in new HashMail servivce
This new service will be used to facilitate communication between the
sidecar provider and recipient.
2021-05-09 19:24:47 -07:00
Oliver Gugger
063f29a73d
Merge pull request #253 from guggero/rest-lsat-url
poolrpc: namespace URI of LSAT REST call
2021-05-06 12:14:40 +02:00
Johan T. Halseth
4e560b6dce
Merge pull request #252 from guggero/quote-order
Add new QuoteOrder RPC
2021-05-06 11:53:23 +02:00
Oliver Gugger
c97f3ceeb0
poolrpc: namespace URI of LSAT REST call
When trying to enable a single unified REST proxy in LiT, we noticed
that one URI collides between Loop and Pool (/v1/lsat/tokens).
We change the URI in Pool to fix the collision.

This is a potentially breaking change! Though we do not use REST in LiT
and are not aware of other projects using Pool's REST API yet so it
should impact a small number of users (or nobody really in the best
case).
2021-05-05 16:01:46 +02:00
Oliver Gugger
b676727c30
auctioneerrpc: format proto 2021-05-05 16:00:27 +02:00
Oliver Gugger
8677f8272a
cmd/pool: use QuoteOrder RPC for printing order details
With the same order quote calculation now available as an RPC, we no
longer need to do the calculation in the CLI code and can instead use
the new QuoteOrder call.
2021-05-05 15:58:50 +02:00
Oliver Gugger
ddbc7444d5
poolrpc+rpcserver: implement QuoteOrder RPC
We create an RPC wrapper around the new order.NewQuote function with the
goal of replacing the calculation that currently only exists in the CLI
with an actual RPC call.
2021-05-05 15:57:34 +02:00
Oliver Gugger
1a68069bc2
order: add NewQuote function
We port over the order quote calculation from the CLI to the order
package so we can also offer the same calculation over RPC.
2021-05-05 15:55:45 +02:00
Johan T. Halseth
5234896f98
Merge pull request #251 from guggero/aperture-update
mod: bump aperture to v0.1.6-beta
2021-04-29 12:19:18 +02:00
Oliver Gugger
d97aa26856
mod: bump aperture to v0.1.6-beta
With this commit we update to v0.1.6-beta of the aperture dependency
which fixes the issue of pending LSAT tokens not being removed even if
the payment failed for good.
2021-04-29 10:05:08 +02:00
Johan T. Halseth
9a0766cc30
Merge pull request #247 from guggero/db-timeout
macaroons+clientdb: add timeout to DB open
2021-04-27 11:24:31 +02:00
Oliver Gugger
16fc005a61
macaroons+clientdb: add timeout to DB open
To make sure we don't just block for forever if another Pool daemon
process is already running, we add a timeout and error out if obtaining
the unique file lock fails after 5 seconds.
2021-04-27 10:19:55 +02:00
Olaoluwa Osuntokun
39b88905b9
Merge pull request #246 from PierreRochard/grpc-tls-h2-fix
rpcserver: fix Python gRPC client ALPN property error
2021-04-26 13:09:02 -07:00
Pierre Rochard
b4666cd56a rpcserver: fix Python gRPC client ALPN property error
There is an open issue for Python gRPC clients that is
currently being debugged https://github.com/grpc/grpc/issues/23172

It can be mitigated server-side by specifying h2 in the metadata header.
2021-04-23 14:56:48 -05:00
Olaoluwa Osuntokun
3c71603e5b
Merge pull request #245 from guggero/api-docs-fix
poolrpc: fix command example that broke API docs
2021-04-21 12:19:39 -07:00
Oliver Gugger
01e88189c8
poolrpc: fix command example that broke API docs
The command example for the `sidecar expectchannel` was incorrect which
lead to the API docs generator erroring out.
2021-04-21 15:24:37 +02:00
Olaoluwa Osuntokun
8c95de79dc
Merge pull request #235 from lightninglabs/sidecar-accept
sidecar channels 3/3: Accept sidecar channels
2021-04-07 17:27:02 -07:00
Oliver Gugger
5f7f4cd7f4
multi: add sidecar channel info to leases list
A sidecar channel uses different multisig keys than a normal order so we
need to fix the lookup in the batch transaction. While we're at it, we
might as well return the self chan balance and whether it was a sidecar
channel in the leases response.
2021-04-07 14:19:30 +02:00
Oliver Gugger
14da89be07
cmd/pool: add sidecar commands for offer/register/expect
With the RPC methods now in place, we add a new sidecar subcommand to
our CLI and add verbs for interacting with sidecars to it.
Because the ticket is in an encoded form we also add a printticket
subcommand for easy inspection.
2021-04-07 14:14:11 +02:00
Oliver Gugger
15eeee2a3e
multi: add sidecar offer/register/expect RPCs
With this commit we add the ability to both create/expect a sidecar offer as a
provider as well as registering an offer as the recipient to the main
RPC server.
2021-04-07 14:14:10 +02:00
Oliver Gugger
76006c565e
Merge pull request #244 from taxmeifyoucan/patch-1
Fix typo
2021-04-07 11:01:15 +02:00
Mário Havel
f0c5daa9e0
Fix typo
Fixing 'timel-ocked' typo
2021-04-07 09:52:58 +01:00
Olaoluwa Osuntokun
c36273fae5
Merge pull request #243 from lightninglabs/account-recover-lsat-fix
rpcserver: fix LSAT issue on account recovery
2021-04-06 18:45:58 -07:00
Oliver Gugger
16609b8eaf
rpcserver: update sidecar provider ticket state
If we're the provider of sidecars, we also want to update our local
sidecar ticket database whenever an order is matched in a batch or is
canceled.
2021-04-06 13:41:50 +02:00
Oliver Gugger
33c04894a0
funding: skip match prepare part as sidecar provider
If we're the provider of a sidecar channel we don't have to register a
funding shim or connect out to the taker. We'll just have to provide the
signature in the next step.
2021-04-06 13:41:50 +02:00
Oliver Gugger
7674551331
funding: don't wait for sidecar channels as provider
If we're the provider of a sidecar channel we don't have to wait for an
incoming channel as that won't be opened towards us. Therefore if there
are only sidecar channels in a batch, we don't have to wait at all.
2021-04-06 13:41:50 +02:00
Oliver Gugger
44dc381573
sidecar_acceptor: resume pending tickets on startup
In case we have to restart in the middle of expecting a sidecar channel,
we have to resume all pending tickets on startup.
2021-04-06 13:41:50 +02:00
Oliver Gugger
71b7f419d8
order+funding: use correct multisig key
If we're the provider of a sidecar channel then we don't actually have
the private key of the funding multisig key. Therefore we cannot
re-derive it on demand and have to use the key provided in the sidecar
ticket instead.
2021-04-06 13:41:49 +02:00
Oliver Gugger
482f4828b9
server+sidecar_acceptor: consume auction messages
Whenever we are expecting a sidecar channel with us as the recipient, we
subscribe to the auction server through the special new SubscribeSidecar
RPC that works exactly the same as the SubscribeBatchAuction with the
only difference that we can use our channel funding multisig key as the
authentication key instead of the trader account key.
We have to react to all batch auction messages but our role is somewhat
simplified as we don't have to fully verify or sign the batch itself.
2021-04-06 13:36:31 +02:00
Oliver Gugger
36b30a741d
multi: add auctioneer client to sidecar acceptor 2021-04-06 13:36:31 +02:00