238 Commits

Author SHA1 Message Date
Antoine Poinsot
b9753b48d0
descriptors: update the satisfaction size estimation
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.
2023-07-13 09:56:10 +02:00
Antoine Poinsot
0ac4d80ddb
commands: fix two clippy lints
For some reason it started warning about them after the upgrade of
rust-miniscript.
2023-07-13 09:56:10 +02:00
Antoine Poinsot
e28010915f
lianad: update rust-miniscript (and rust-bitcoin) dependencies
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.
2023-07-13 09:56:09 +02:00
Antoine Poinsot
c20c05cee7
ci: upgrade lianad clippy to 1.70 2023-06-28 10:23:15 +02:00
Antoine Poinsot
b2f95ada58
commands: take advantage of 1.48 compat riddance 2023-06-27 17:26:44 +02:00
raphjaph
700f6e1d6f make compilable on aarch64 (M1) 2023-05-24 00:08:54 +02:00
Antoine Poinsot
ec55348693
Merge #499: sqlite: prevent races when updating the next derivation index
039b82d9b3e11786f09c761a6d0a6d137cdff8ad 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 039b82d9b3e11786f09c761a6d0a6d137cdff8ad

Tree-SHA512: e245d8732346731c5a98223363c9d2e77f3a568e046055007162167f7a7209cc0e9d0f57c7219e469788ff73c570962396c4da0e056c790ffffbd953c75ab3ee
2023-05-12 13:03:26 +02:00
Antoine Poinsot
039b82d9b3
sqlite: prevent races when updating the next derivation index 2023-05-12 12:08:55 +02:00
Antoine Poinsot
0f07361d9b
bitcoind: adapt the warning detection with interface breakage in v25 2023-05-12 11:27:46 +02:00
Antoine Poinsot
3a82c3a81d
bitcoind: do not assert presence of 'warning' field in unloadwallet response 2023-05-12 10:57:23 +02:00
Antoine Poinsot
8debaf8e83
Merge #490: Release 1.0 preparation
fe906da6123d9741a6a1d3d8d94e6f632138e56f Bump version to 1.0.0 (Antoine Poinsot)
73902627d69ae7a525ed732bbd255a6daaf216e4 Add a SECURITY.md (Antoine Poinsot)
664a9b6cf57774456e56a83aa97a20e41abd52d6 Documentation updates for v1.0 (Antoine Poinsot)
1f9b78383a334ceeda276a8d3a27ad4673a33349 CHANGELOG: add v1.0 release notes (Antoine Poinsot)
e685f3b55cac4712b0a2e9d0bf4674b9916b1fd5 contrib: fix guix build to use lianad's master (Antoine Poinsot)

Pull request description:

ACKs for top commit:
  darosior:
    self-ACK fe906da6123d9741a6a1d3d8d94e6f632138e56f

Tree-SHA512: 3412855d292c00de5b40171f555f661f64927f1bc635fa36fad70fe9bec93551bf9421e6c75d6d26fd9cdc8f6536979b8417db50617c484ae80ef2289b07ddb5
2023-05-11 17:05:06 +02:00
Antoine Poinsot
17d1f847bc
lib: on Windows unload the watchonly wallet before deleting it 2023-05-11 12:22:48 +02:00
Antoine Poinsot
fe906da612
Bump version to 1.0.0 2023-05-11 11:44:57 +02:00
Antoine Poinsot
c6c312a011
commands: allow to create send-to-self transactions with 'createspend' 2023-05-04 16:15:09 +02:00
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