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.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.