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