The latest rust-miniscript version deprecated the helper we were using,
in favour of one that gives the maximum size difference of a transaction
input before and after satisfaction. The new helper differs in that it
does not account for the empty ScriptSig byte (which uncovered we were
actually double-counting it), and assumes the non-satisfied transaction
input is already part of a Segwit transaction (which we rectified).
This uncovered a mistake in the computation of the witness script size
in the unit test. We also get rid of the needless wu_to_vb() standalone
function.
Rust-bitcoin, that we use through rust-miniscript, has seen plenty of
breaking changes in the latest version. I've tried to keep the necessary
changes here minimal, still it had to be a single commit to keep it
hygienic. But i'll try to summarize the main things here. Tobin also
wrote a guide about the release at
https://rust-bitcoin.org/blog/release-0.30.0/.
The most verbose change in this commit is probably due to the `Address`
type overhaul. It's overengineered if you ask me but hey here we are. I
tried to keep network validation in commands, and otherwise passing
around unchecked addresses (to avoid having to pass around a global
state between our various components).
Another non-obvious change was changes in hash types upstream and the
removal of `ToHex`, forcing us to get the hex representation of a txid
through its `Display` implementation. It is however displayed backward
in this case ("little-endian" if you will), and we need a regular hex
encoding for some queries to the database. We needed to make sure we
didn't implement any silent bug here.
The rest (Script type changes, PSBT serialization updates, ..) is
probably self-explanatory.
039b82d9b3 sqlite: prevent races when updating the next derivation index (Antoine Poinsot)
Pull request description:
You can check the unit test triggering the race fails on master. I'm pretty sure it's the reason for the address generation bug i experienced yesterday when testing.
ACKs for top commit:
edouardparis:
utACK 039b82d9b3
Tree-SHA512: e245d8732346731c5a98223363c9d2e77f3a568e046055007162167f7a7209cc0e9d0f57c7219e469788ff73c570962396c4da0e056c790ffffbd953c75ab3ee
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.
9394be645c [bugfix] descriptors: fix parsing of descriptor with 1-of-N multisig (Antoine Poinsot)
1a13b7a6f8 descriptors: rename InheritanceDescriptor into SinglePathLianaDesc (Antoine Poinsot)
8d1c6de5dd descriptors: rename MultipathDescriptor into LianaDescriptor (Antoine Poinsot)
f6885e358b descriptors: cleanup error types (Antoine Poinsot)
647d65fe04 descriptors: create Liana descriptors through the policy (Antoine Poinsot)
9b866300be descriptors: merge the semantic analysis in one place (Antoine Poinsot)
cd566b91af descriptors: rename LianaDescInfo into LianaPolicy (Antoine Poinsot)
757009536b descriptors: make sure there is at least one timelocked path when parsing (Antoine Poinsot)
eebfa47559 descriptors: move descriptor policy analysis into its own submodule (Antoine Poinsot)
c0dd63dfb2 descriptors: move the LianaDescKey to the keys submodules (Antoine Poinsot)
7772ae8d8a descriptors: move derived keys into their own submodule (Antoine Poinsot)
9e78ac7e8d 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 9394be645c
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.
ebf5a294ad gui: fix some clippy warning (Antoine Poinsot)
cf3e9cafe0 ci: run clippy using Rust 1.67.1 (Antoine Poinsot)
8965758421 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 ebf5a294ad -- 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.