224 Commits

Author SHA1 Message Date
Antoine Poinsot
a076a83cba
Reset the daemon and GUI versions post 0.4 branch-off 2023-04-13 08:54:18 +02:00
Antoine Poinsot
baf68e8224
lianad: bump version 2023-04-10 11:23:55 +02:00
Antoine Poinsot
104c6e1a09
commands: add an 'updated_at' field to listspendtxs entries 2023-04-05 12:41:03 +02:00
Antoine Poinsot
6b666e75c0
db: unit test the migration from v0 to v1 2023-04-05 12:41:03 +02:00
Antoine Poinsot
29ae0a4a5e
db: add a new 'updated_at' column to Spend transactions
Since this is our first modification to the database schema since the
first release of the software this also introduces migration logic for
existing databases.
2023-04-05 12:41:02 +02:00
Antoine Poinsot
d68d0e1134
commands: adapt 'createrecovery' to multiple recovery paths 2023-04-04 11:53:22 +02:00
Antoine Poinsot
cfbb02c7c8
descriptors: multi-recovery-path Liana descriptor
This makes it possible to have more than one recovery path in a Liana
descriptor. The descriptor and partial spend analysis are adapted to
report information about all recovery paths.
2023-04-04 11:53:21 +02:00
Antoine Poinsot
ec0009113a
descriptors: lift the bounds to create a Liana policy
Since we now use the Miniscript compiler, there is no reason not to
allow more than 20 keys.
2023-04-04 11:50:27 +02:00
Antoine Poinsot
55d86c62a5
descriptors: use the Miniscript compiler to create a descriptor 2023-04-04 11:50:26 +02:00
jp1ac4
89eb1572e9
lib: reorder struct fields for consistency 2023-04-04 09:38:58 +01:00
jp1ac4
b519c8d185
lib: rename and use existing structs (Db)SpendBlock 2023-04-04 09:27:03 +01:00
jp1ac4
4cb6d2dc69
lib: couple block height and time 2023-04-03 10:47:04 +01:00
Antoine Poinsot
f0beef5f60
bitcoind: do not error if watchonly wallet is loading on bitcoind 2023-03-31 14:00:05 +02:00
Antoine Poinsot
2b76180cdf
Merge #374: Cleanup the descriptors module
9394be645c698591da9c477dd77363010cb3298e [bugfix] descriptors: fix parsing of descriptor with 1-of-N multisig (Antoine Poinsot)
1a13b7a6f820e92ff436198bffc78b8ad785a758 descriptors: rename InheritanceDescriptor into SinglePathLianaDesc (Antoine Poinsot)
8d1c6de5dde85583a6fb3a03458774d113ccb7b9 descriptors: rename MultipathDescriptor into LianaDescriptor (Antoine Poinsot)
f6885e358bfe78a790226e6246dad4922cf82d02 descriptors: cleanup error types (Antoine Poinsot)
647d65fe045a71158041cfb4bf5b98e5200db2e8 descriptors: create Liana descriptors through the policy (Antoine Poinsot)
9b866300be53be8a4e49e7913be25ff8887eac63 descriptors: merge the semantic analysis in one place (Antoine Poinsot)
cd566b91af07a53f9651c034ef4da95a8a033c56 descriptors: rename LianaDescInfo into LianaPolicy (Antoine Poinsot)
757009536b489b333ddb6a2d6bf237196e930e4e descriptors: make sure there is at least one timelocked path when parsing (Antoine Poinsot)
eebfa4755944f14aaa23f8b1a293a1b6a0f0f30f descriptors: move descriptor policy analysis into its own submodule (Antoine Poinsot)
c0dd63dfb2b6831666fb260581dce36e6f7601fa descriptors: move the LianaDescKey to the keys submodules (Antoine Poinsot)
7772ae8d8a74dc0f52be0381a77e68e4d2e8478f descriptors: move derived keys into their own submodule (Antoine Poinsot)
9e78ac7e8dd8bfb7170f64aa314aea30921aca4b descriptors: make the module a folder. (Antoine Poinsot)

Pull request description:

  We've been piling a bunch of new features since this module was first architectured, and it has become messy. This led to duplicate code, a confusing interface (`InheritanceDescriptor`, `LianaDescInfo`, ..) and more importantly bugs.

  This is a complete re-organization of the module in view of introducing multi-paths descriptors soon. This PR contains two bugfixes but aside from that it should not change (correct) behaviour. It does however completely break the interface.

  The new interface makes a lot more sense:
  - A `LianaPolicy` representing a Liana spending policy, from which you can get the parameters for the various spending path, and you can create from those parameters.
  - A `LianaDescriptor` which can be created from a `LianaPolicy`, and from which you can infer a `LianaPolicy` to retrieve the parameters of each spending path.

  This bijection (although it will soon become a surjection as we'll introduce the Miniscript policy compiler to create a `LianaDescriptor` from a `LianaPolicy`) makes the life of a client of the API easier, but it also harmonizes the code: we've centralized the Miniscript Semantic Policy checks of a descriptor in a single place to make sure that we can parse only what, and all, descriptors we can create.

ACKs for top commit:
  edouardparis:
    ACK 9394be645c698591da9c477dd77363010cb3298e

Tree-SHA512: 784eee825644db43417ec040f85b9e20ab72bcc545eed68a2b9b5a5945f86bea6e2d7b091e438b7ba8d4e0a6963459f2b29af59995a407a3c509b5be0fd06e9b
2023-03-28 12:21:50 +02:00
Antoine Poinsot
9394be645c
[bugfix] descriptors: fix parsing of descriptor with 1-of-N multisig 2023-03-27 16:56:12 +02:00
Antoine Poinsot
7279a3205e
Merge #166: deps: make libc optional
4bf5234ce97fa725c076be628c12b7289466c1f1 Cargo.lock: update libc (Antoine Poinsot)
6ea9ba5c1c661eb26edd17212dd34459a006a981 Cargo: get rid of the jsonrpc_server feature. (Antoine Poinsot)
cc8844671773e2fbfe0c17fdf504ff2bed769413 deps: make libc optional (edouard)

Pull request description:

ACKs for top commit:
  darosior:
    ACK 4bf5234ce97fa725c076be628c12b7289466c1f1

Tree-SHA512: 0d754d8201c74b88edc5bf1166bd8ff33a25fd4490e58d3a6f23bbf3a7970881706181228e17683cd7030d7ae94ebbcff0bbcfaa42a96fdc684fbbaca58a1d58
2023-03-24 17:59:33 +01:00
Antoine Poinsot
6ea9ba5c1c
Cargo: get rid of the jsonrpc_server feature.
It implies daemon. (Also, it needed libc.)
2023-03-24 17:46:37 +01:00
Antoine Poinsot
1a13b7a6f8
descriptors: rename InheritanceDescriptor into SinglePathLianaDesc
It was named at a time where there was an over emphasis on inheritance
as a Liana usecase. In addition, "SinglePath" reflects better it is only
one part of the main, multipath, Liana descriptor.
2023-03-23 19:15:54 +01:00
Antoine Poinsot
8d1c6de5dd
descriptors: rename MultipathDescriptor into LianaDescriptor 2023-03-23 19:15:53 +01:00
Antoine Poinsot
f6885e358b
descriptors: cleanup error types
This removes circular dependencies and apply the appropriate variants to
the appropriate enums.
2023-03-23 19:15:52 +01:00
Antoine Poinsot
647d65fe04
descriptors: create Liana descriptors through the policy
This makes it possible for a LianaPolicy to be created from a user
configuration. This in turn centralizes the descriptor creation inside
it as well and make `MultipathDescriptor` take a `LianaPolicy` directly.

This is useful to centralize all the Miniscript and Miniscript policy
handling under in a single place as we'll soon be managing much more
complex policies (and make use of the Minsicript policy compiler).

Unfortunately this is an invasive API change. But at least the API now
makes a lot more sense: you can create a spending policy from a
configuration and create a descriptor from it. And vice-versa you can
infer a spending policy from a descriptor and inspect the configuration
from it.
2023-03-23 19:15:52 +01:00
Antoine Poinsot
9b866300be
descriptors: merge the semantic analysis in one place
This merges the Miniscript policy semantic analysis we perform both when
parsing a descriptor and when gathering information about a Liana
descriptor in one, right, place: the analysis submodule.
2023-03-23 19:15:51 +01:00
Antoine Poinsot
cd566b91af
descriptors: rename LianaDescInfo into LianaPolicy
What this really represents is a spending policy. We'll extend it to be
able to infer it from a descriptor and to create a descriptor from it.
2023-03-23 16:25:01 +01:00
Antoine Poinsot
757009536b
descriptors: make sure there is at least one timelocked path when parsing 2023-03-23 16:10:21 +01:00
Antoine Poinsot
eebfa47559
descriptors: move descriptor policy analysis into its own submodule 2023-03-23 16:09:55 +01:00
Antoine Poinsot
c0dd63dfb2
descriptors: move the LianaDescKey to the keys submodules 2023-03-23 14:43:18 +01:00
Antoine Poinsot
7772ae8d8a
descriptors: move derived keys into their own submodule 2023-03-23 14:37:43 +01:00
Antoine Poinsot
9e78ac7e8d
descriptors: make the module a folder. 2023-03-23 14:25:13 +01:00
Antoine Poinsot
eebd061981
bitcoin: remove a confusing TODO
We don't assume that and in fact now use multiple descriptors
2023-03-22 14:58:30 +01:00
Antoine Poinsot
2dea4b1a6c
Merge #355: Clippification: a little bit of housekeeping
ebf5a294ad5eeb9359625e941013809f5544672b gui: fix some clippy warning (Antoine Poinsot)
cf3e9cafe05d703637e09220351113d7be4458e4 ci: run clippy using Rust 1.67.1 (Antoine Poinsot)
896575842119a5e2779309edea4f9b4141126825 bitcoind: fix a clippy warning about lifetime ellision (Antoine Poinsot)

Pull request description:

  FIx clippy lints and bump the clippy version for the daemon. Also fix some lints for the GUI (there are some false positives that couldn't be fixed though).

ACKs for top commit:
  darosior:
    self-ACK ebf5a294ad5eeb9359625e941013809f5544672b -- trivial

Tree-SHA512: 3fccbce67637d417da1758584f1d4f027e1536054b21c7abafc2e6b70e65901abb373a1ffc7fc7efbbbdf5c504ccde9df75e477d72ecd46a8b7798ce7985f64d
2023-03-21 18:51:02 +01:00
edouard
cc88446717 deps: make libc optional
libc dependency is only use by the lianad
binary it is not needed for liana-gui.
This commit makes the dependency optional
by introducing a new default feature named
daemon.

liana/src/daemonize.rs is still compiling
because the feature daemon is marked as required
for the lianad binary.
2023-03-14 09:39:36 +01:00
Antoine Poinsot
b8cd0d0e27
Bump version to 0.3 2023-02-27 14:46:28 +01:00
Antoine Poinsot
8965758421
bitcoind: fix a clippy warning about lifetime ellision 2023-02-17 10:22:08 +01:00
Antoine Poinsot
518eb91064
commands: print the PSBT in base64 on sanity checks failure
To make it readable..
2023-02-17 09:54:43 +01:00
Antoine Poinsot
6e1c41238f
commands: have a detailed error for the insane fee sanity check 2023-02-17 09:54:43 +01:00
Antoine Poinsot
c711c5b696
commands: don't overestimate the feerate in tx creation sanity checks
It was accounting for the transaction size without witnesses!
2023-02-16 16:09:54 +01:00
edouard
200d3777e0
Merge #293: Hot wallet support
20f394a452e425f4bdad0195637612499575a878 random: add a commented-out test i used to run ENT (Antoine Poinsot)
157eea989322eed2ea9553d3640e884fb657541a lib: re-export the bip39 dependency (Antoine Poinsot)
50f13d3e2e2802ebbc6efceccb03eafe352b1e77 signer: allow to the set the network for extended keys encoding (Antoine Poinsot)
f5e7632c73abef4f27f5617c877caf8574b3fe3b signer: expose a method for signing a PSBT (Antoine Poinsot)
b88874107e3b45876a63506ab67afbc710cd2a27 signer: add a method to get the xpub at a given path (Antoine Poinsot)
59e55ae9f2c33f4865ff28282325a5cf156ca37e signer: implement mnemonics storage, and initialization from storage (Antoine Poinsot)
d341b6dea9d7eb9663eb9a4ef55617340146dc1e signer: cache the master xpriv (Antoine Poinsot)
6e3b951e5452a3cd4a050bde32ee930f6613e601 signer: a new module with a BIP39-based hot signer (Antoine Poinsot)

Pull request description:

  This introduces a new `signer` module. Its purpose is to provide clients of the Liana daemon (such as the GUI) with tools to sign transactions.

  For now, the only signer available is a hot signer based on BIP39. It allows to generate new mnemonics from OS-provided randomness (with added randomness from the CPU if available and mixed-in contextual data). Mnemonics are stored in plaintext in a `mnemonics` folder at the root of a provided data directory.

  Fixes #49.

ACKs for top commit:
  edouardparis:
    ACK 20f394a452e425f4bdad0195637612499575a878

Tree-SHA512: 299476fdec69139cab9428e8466b4d320798ecd91a08251cac9d1fb086e43cffdb296eca4061a022a7182b5df2101977bb8300ead0d31f3f75988792145bba7f
2023-02-16 09:26:11 +01:00
Antoine Poinsot
20f394a452
random: add a commented-out test i used to run ENT
https://www.fourmilab.ch/random/

Entropy = 8.000000 bits per byte.

Optimum compression would reduce the size
of this 912444480 byte file by 0 percent.

Chi square distribution for 912444480 samples is 254.09, and randomly
would exceed this value 50.43 percent of the times.

Arithmetic mean value of data bytes is 127.4952 (127.5 = random).
Monte Carlo value for Pi is 3.141641048 (error 0.00 percent).
Serial correlation coefficient is 0.000022 (totally uncorrelated = 0.0).
2023-02-14 17:41:30 +01:00
Antoine Poinsot
157eea9893
lib: re-export the bip39 dependency 2023-02-14 17:41:30 +01:00
Antoine Poinsot
50f13d3e2e
signer: allow to the set the network for extended keys encoding 2023-02-14 17:41:29 +01:00
Antoine Poinsot
f10c35e964
daemonize: switch the pid and log file arguments
The caller and the definition had them swapped.. So it was logging to
the PID file and writing the PID to the log file..
2023-02-13 10:56:22 +01:00
Antoine Poinsot
f5e7632c73
signer: expose a method for signing a PSBT 2023-02-10 12:21:23 +01:00
Antoine Poinsot
b88874107e
signer: add a method to get the xpub at a given path 2023-02-10 12:21:22 +01:00
Antoine Poinsot
59e55ae9f2
signer: implement mnemonics storage, and initialization from storage 2023-02-10 12:21:22 +01:00
Antoine Poinsot
d341b6dea9
signer: cache the master xpriv 2023-02-10 12:21:21 +01:00
Antoine Poinsot
6e3b951e54
signer: a new module with a BIP39-based hot signer 2023-02-10 12:21:21 +01:00
Antoine Poinsot
f8e5bb22ac
bitcoind: don't crash on existing watchonly wallet, return an error. 2023-02-09 17:03:53 +01:00
Antoine Poinsot
b43a90d52a
lib: on Windows, delete leftover watchonly wallet in bitcoind datadir 2023-02-09 17:03:52 +01:00
edouard
0f71cbd7c5 Add wallet path in bitcoind errors related to wallet 2023-02-08 14:24:36 +01:00
Antoine Poinsot
9996483112
Merge #321: Descriptor spending policy inference fixes
fcc1c21dbb3a735407d0352c555f448ae80fac64 descriptors: use the origin as xpub UID in partial spend info, not the fingerprint (Antoine Poinsot)
4af1a12a2a239a25c3ab50e4943fa7897be40091 descriptors: fix the spending policy inference (Antoine Poinsot)

Pull request description:

  The analysis was assuming missing that a `thresh(2, older(x), thresh(k, key1, key2, ..)` policy could be normalized to `thresh(k + 1, older(x), key1, key2, ..)` when `k == the number of keys` (i.e. in case of a N-of-N multisig). This also merges the analysis logic with the parsing check to make sure we don't introduce any inconsistency.

ACKs for top commit:
  edouardparis:
    utACK fcc1c21dbb3a735407d0352c555f448ae80fac64

Tree-SHA512: d12db2ccf43d20fc85ea6f9fdfe2869948d2c63a2af22287c9133cf6f732fe92c7c0c63ba70ea3dfb0c910a93753ebd42cb168b4cf6bd6ccbed4e1cc7028b614
2023-02-06 11:43:12 +01:00