Commit graph

64 commits

Author SHA1 Message Date
Wilmer Paulino
dc8ad76c60 account: extract resumeAccount operations on StateOpen into method 2020-04-20 11:45:08 -07:00
Olaoluwa Osuntokun
883632c0d6 Merge pull request #54 from guggero/admin-rpc
server: add admin RPC
2020-04-16 19:55:49 -07:00
Oliver Gugger
6cbd12ffd8 make+auctioncli: add CLI to interact with auction 2020-04-14 16:27:06 +02:00
Oliver Gugger
d2d7e7b006 clientdb: add missing types to codec 2020-04-14 15:41:22 +02:00
Oliver Gugger
367a67c3d7 client+order: remove account from account tally 2020-04-14 15:41:21 +02:00
Olaoluwa Osuntokun
b3e30aaa14 Merge pull request #52 from guggero/order-segregation
orders: segregate active from pending orders on the server-side
2020-04-10 14:13:37 -07:00
Olaoluwa Osuntokun
da5a56b037 Merge pull request #58 from guggero/flake-unit
test: fix flake in race and unit tests
2020-04-09 19:31:37 -07:00
Wilmer Paulino
f8811b9acf account: sort spending transaction according to BIP-69 2020-04-09 09:39:46 -07:00
Wilmer Paulino
2e21bd4971 account: sanity check input and output amounts in spending transaction 2020-04-09 09:39:45 -07:00
Wilmer Paulino
4514df1476 account: refactor toWalletOutput creation outside of createSpendTx 2020-04-09 09:39:44 -07:00
Wilmer Paulino
3edeba4b94 account: rename createCloseTx and refactor return values into struct
This is done in preparation for future work in which we'll allow custom
inputs and outputs to be provided when crafting the spending transaction
of an account.
2020-04-09 09:39:44 -07:00
Oliver Gugger
31adef0e2c client+order: define archived state 2020-04-09 14:32:01 +02:00
Oliver Gugger
a637d5b540 client+order: fix flaky unit tests
Some of the test cases relied on a map's keys always being in the
order they were defined, which is not guaranteed by the runtime.
A data race is also fixed by creating a new instance of the verifier
for each run.
2020-04-09 13:14:30 +02:00
Oliver Gugger
14aed0976a client+order: fix double encoding of order nonces 2020-04-09 13:14:06 +02:00
Oliver Gugger
15e7a28ccb client+order: fix fee calculation errors 2020-04-03 21:53:04 +02:00
Oliver Gugger
30faf6188b client: add batch persistence 2020-04-03 21:53:04 +02:00
Oliver Gugger
42adb28ff5 client: verify batch 2020-04-03 21:50:22 +02:00
Oliver Gugger
84d8379341 client+order: calculate account dust size 2020-04-03 21:50:21 +02:00
Oliver Gugger
ac7ad38d08 client: send batch version on connect 2020-04-03 21:50:20 +02:00
Oliver Gugger
f6a8946199 clmrpc: add missing fields for batch verification 2020-04-03 21:50:19 +02:00
Olaoluwa Osuntokun
b7ec7b9977 client/auction: remove unused Phase enum 2020-04-02 17:15:38 -07:00
Oliver Gugger
431d98a159 client+rpcserver: cancel block ntfn on shutdown 2020-03-25 16:14:14 +01:00
Oliver Gugger
e6609160ce client+order: add LinearFeeSchedule 2020-03-24 10:14:45 +01:00
Oliver Gugger
54e4c84f46 clmrpc: add FeeQuote call 2020-03-24 10:09:57 +01:00
Oliver Gugger
03ea874da0 client+order: add fee calculation code 2020-03-17 13:34:27 +01:00
Oliver Gugger
4e2553ee18 client+order: rename CalcFee to PerBlockPremium 2020-03-17 13:19:49 +01:00
Oliver Gugger
790f05b851 clientdb: allow multiple order updates in same TX
With this commit we prepare the client order database to allow
multiple manipulations to occur in a single database transaction.
2020-03-12 15:18:19 +01:00
Oliver Gugger
fe8e4d5e79 clientdb: allow multiple account updates in same TX
With this commit we prepare the client account database to allow
multiple manipulations to occur in a single database transaction.
2020-03-12 15:17:32 +01:00
Olaoluwa Osuntokun
369ea2aa8e client/clmscript: fix errors in witness size estimation
In this commit, we fix a few lingering errors in witness size
estimation. Both the witness paths were missing a single byte that
signals the number of witness elements. We also convert the OP_DATAs in
the witness script to a varint length, as that more accurately reflects
the way the field is interpreted, as we provide the witness stack as is,
rather than pushing elements onto the stack as if it were a sigScript.
Finally, we add a missing byte for the size of the witness script
itself.
2020-03-09 20:00:20 -07:00
Olaoluwa Osuntokun
6f9ed22e04 client/order: declare BaseSupplyUnit as the SupplyUnit type 2020-03-04 16:34:54 -08:00
Oliver Gugger
64ccc3ae63 client+watcher: cancel contexts on shutdown 2020-03-04 15:16:56 +01:00
Oliver Gugger
7579b158fc client: implement stream RPC 2020-03-04 15:11:08 +01:00
Oliver Gugger
e70fc124eb clmrpc: add stream messages 2020-03-04 14:17:04 +01:00
Oliver Gugger
2c88c6de18 client: refactor to start/stop model 2020-02-26 11:59:36 -03:00
Oliver Gugger
1979f714ed client: add stream interceptor 2020-02-20 10:17:24 +01:00
Oliver Gugger
c1954cc51c client+clmrpc: rename ChannelAuctioneerClient to Trader 2020-02-20 10:15:52 +01:00
Wilmer Paulino
9bf50766f7 multi: allow account closure through expiration and multi-sig paths
Traders are now able to close their accounts, whether or not they have
already expired, to arbitrary outputs or to a wallet output by default.
If an account hasn't expired, then the auctioneer's signature of the
closing transaction is required to successfully close the account.
2020-02-05 12:09:47 -08:00
Wilmer Paulino
1b2aa96a51 clmscript: add account witness script helpers 2020-02-05 12:09:16 -08:00
Wilmer Paulino
f9faebc842 account: mark accounts as expired once their expiry is reached
Accounts in this state remain in it until they're renewed or closed.
These functionalities will be added at a later time.
2020-02-05 12:09:11 -08:00
Wilmer Paulino
3323968d44 watcher: wait for initial block notification before handling requests
Otherwise, it's possible for an expiry request to be handled before the
first block notification that sets our best height is received, causing
us to not fulfill the request if the corresponding expiry had already
been reached.
2020-02-05 11:56:29 -08:00
Wilmer Paulino
4faa015679 account: only transition accounts to StateOpen from StatePendingOpen
Otherwise, we can risk transitioning an account from another state,
e.g., StateExpired back to StateOpen if the account confirms at the same
height it expires.
2020-02-05 11:56:25 -08:00
Wilmer Paulino
4930da65b0 clmscript: use more efficient script construction for accounts
The new construction saves about 35 bytes over the existing one. The
reduction in size comes from only encoding each public key (the trader's
and auctioneer's) once and not using the extra opcodes for
OP_CHECKMULTISIG.
2020-02-03 12:15:47 -08:00
Wilmer Paulino
4021b2919c multi: tweak trader key with shared secret and per-batch key
In this commit, we overhaul the keys used in the multi-sig construction
of an account to prevent script reuse and provide plausible deniability
between account outputs to third parties. This is done by tweaking the
trader's key with two new components:

1. A per-batch key, which is obtained from the auctioneer during account
creation. Every time the account is modified or participates in a
cleared batch within the system, the per-batch key is incremented by the
curve's base point, resulting in a different key used in the account
script.

2. A shared secret derived using Diffie-Hellman between the trader's and
auctioneer's base keys. By using this secret, we provide plausible
deniability to third parties with knowledge of the base keys and
per-batch key.

The resulting tweaked key for the trader is then used as the tweak for
the auctioneer's base key.
2020-01-29 13:23:15 -08:00
Wilmer Paulino
30c3d0699c clmscript: add utility function IncrementKey
This increments a given key by its curve's base point.
2020-01-27 18:07:14 -08:00
Wilmer Paulino
004e1cf857 multi: use btcec.PublicKey instead of [33]byte
This allows us to use utility functions that require the use of a parsed
public key without needing to parse every time.
2020-01-24 13:45:48 -08:00
Oliver Gugger
976df85bb1 trader: prepare to be used as library 2020-01-20 14:44:22 +01:00
Oliver Gugger
17a71068ad cmd/agora: add commands for submitting orders 2020-01-17 17:41:26 +01:00
Oliver Gugger
d59b603e45 client+order: store order 2020-01-17 17:41:25 +01:00
Oliver Gugger
adb5afadba client/clmrpc: add missing order fields 2020-01-17 17:27:39 +01:00
Oliver Gugger
42717b1074 mod: update to latest versions of lnd, loop and kirin 2020-01-13 09:23:32 +01:00