1538 Commits

Author SHA1 Message Date
edouardparis
2debb32181 Add taproot support to installer descriptor editor step 2024-03-20 17:33:39 +01:00
edouardparis
8bc0cac00a gui: async-hwi:0.0.16
for the new implem of PartialOrd for
async_hwi::DeviceKind
2024-03-20 17:33:39 +01:00
edouardparis
4a4c78d5f7 bump liana:master 2024-03-20 17:33:39 +01:00
edouardparis
19d9a4b26a
Merge #1022: gui: sort events and txs after push in the list
ff7e30794b7c79c3aa237dde33f52e716703c434 gui: sort events and txs after push in the list (edouardparis)

Pull request description:

  when a pending tx is confirmed, it is pushed in the HistoryTransaction list at the end. It should be first in the list. We sort now the list in order to make sure it will be always the case.

ACKs for top commit:
  edouardparis:
    Self-ACK ff7e30794b7c79c3aa237dde33f52e716703c434

Tree-SHA512: 06c1c48728b7623605a493442eeaca3319afbb29c90e676f42ecd7d6d90843e69947759b538f0acb1324d3bb8c68029b38a66ddb8536db3291f706a57d16c28c
2024-03-20 13:18:49 +01:00
edouardparis
ff7e30794b gui: sort events and txs after push in the list
when a pending tx is confirmed, it is pushed in the
HistoryTransaction list at the end. It should be first
in the list. We sort now the list in order to make sure
it will be always the case.
2024-03-20 13:01:36 +01:00
Antoine Poinsot
dd29578c50
Merge #1020: descriptors: change detection under Taproot
52c3613568736a1f2b4ab57bffcaee31d3d85b35 descriptors: adapt 'change_indexes()' to Taproot (Antoine Poinsot)
0c65d205697cb93e40faae1c4d87972ac19bf787 descriptors: encapsulate change_indexes unit test (Antoine Poinsot)

Pull request description:

  I remember thinking about this helper when working on #985, but for some reason i didn't address it there. Here it is.

ACKs for top commit:
  edouardparis:
    utACK 52c3613568736a1f2b4ab57bffcaee31d3d85b35

Tree-SHA512: 276fdb4087ba0ec097142d7ff7a4c8762814d6423b9f5535c8951d6ef628c164e4a5191aeb9aa48eaad9afd1361416157774341ef7873fee284d039f9dcf5b3e
2024-03-20 11:22:02 +01:00
Antoine Poinsot
52c3613568
descriptors: adapt 'change_indexes()' to Taproot
We match on both the legacy and the Taproot field in the PSBT output. It shouldn't matter since we already assume the PSBT is well-formed.
2024-03-20 10:44:50 +01:00
Antoine Poinsot
0c65d20569
descriptors: encapsulate change_indexes unit test 2024-03-20 10:41:56 +01:00
Antoine Poinsot
2e63bf3069
Merge #1013: fix descriptor in config example
aa7db1b9a38fb04131969b72cc4c744c84562fdb fix descriptor in config example (pythcoiner)

Pull request description:

  fixes #1012

ACKs for top commit:
  jp1ac4:
    ACK aa7db1b9a3. I was able to import this descriptor in a new regtest wallet (using GUI installer).

Tree-SHA512: 6b06024a1717eafa237bad25f69a7aa6856a8f3bb3c8eec8240a2541a5fdfcf339807093c755c0abbc4a4beb27d20c83c7dff96bb099322e0c0c0b9c05059139
2024-03-19 11:29:45 +01:00
edouardparis
cde2adbdce
Merge #1014: fix recovery panel reload
56d9dbb72d5cb4c41355deeb9455c61edc403235 fix recovery panel reload (edouardparis)

Pull request description:

  Once a psbt was generated with the recovery panel
  it is impossible for user to start again a recovery process He is redirected to the previous generated psbt because of the panel state being not reset.

  This commit reset the panel state on reload.

ACKs for top commit:
  edouardparis:
    Self-ACK 56d9dbb72d5cb4c41355deeb9455c61edc403235

Tree-SHA512: fd634f6d9d338cbc05260a84b4ad6638c88f6d9c2af49384827500a4f97e04b457c061268a9beb902b117cff97a39d55d44baa6517e23762a5d49ff537c6f6fc
2024-03-18 12:51:03 +01:00
edouardparis
56d9dbb72d fix recovery panel reload
Once a psbt was generated with the recovery panel
it is impossible for user to start again a recovery process
He is redirected to the previous generated psbt because
of the panel state being not reset.

This commit reset the panel state on reload.
2024-03-18 11:48:08 +01:00
pythcoiner
aa7db1b9a3 fix descriptor in config example 2024-03-17 19:56:14 +01:00
edouardparis
1310896bf6
Merge #991: [GUI] Move qr code to modal
e38c5f123221ad33b9dc116a9c4d9bc269c518e2 move qr code to modal (pythcoiner)

Pull request description:

  fix #949:
  - Remove Qr code from view
  - Add a button `Show QR Code` that display the QRCode in a new modal
  - Increased size of Qr Code as we now have more room

  ![image](https://github.com/wizardsardine/liana/assets/124568858/446793c8-1cee-496b-a818-032a4dda547c)

  ![image](https://github.com/wizardsardine/liana/assets/124568858/0b918e2d-e48d-4b07-adb3-c58f97de42f0)

ACKs for top commit:
  edouardparis:
    ACK e38c5f123221ad33b9dc116a9c4d9bc269c518e2

Tree-SHA512: 7901b07661e900b5a14a1b3b25389f0222b4900e8cb04fe31473a68beb7cd073e6f26149f5f58b4ce34f66b8cc6716b51b0de8405e37ca172462e56a159c9277
2024-03-15 09:42:40 +01:00
pythcoiner
e38c5f1232 move qr code to modal 2024-03-14 19:48:52 +01:00
Antoine Poinsot
b22f22f0bc
Merge #985: Taproot support
4bb2372a63bb4b36ca9f0dd91d2373cff3e9e9a4 qa: drop specific value assertions in coin selection test (Antoine Poinsot)
7eb024afbc43ac73aa29d6b892bc4833067c5a3f fuzz: alternate between generating wsh() and tr() descs (Antoine Poinsot)
b9a462519791b64165719891c6f0e9c867a07372 ci: run functional tests both under Taproot and P2WSH (Antoine Poinsot)
687a0c2816290d09bda8f1323232bc4c643e9a35 qa: adapt hardcoded coin selection tests to Taproot (Antoine Poinsot)
ecef6bff5eaf00305941c04d93a8bac8003f9d34 qa: functional tests lianad using Taproot descriptors (Antoine Poinsot)
96d30db5b868c8f2e6ecc45f1bf6759df582569e signer: taproot support in hot signer (Antoine Poinsot)
80a7dc32aad43fe4c6a1cd0fc41d4ac1bb8a7de6 signer: move p2wsh signing into a dedicated function (Antoine Poinsot)
d6222583be148a6b12caed7b0ede00be317d89c6 command: also update Taproot sigs in 'updatespend' (Antoine Poinsot)
714bd3c4eda1420142b5761623808f73c64578c6 spend: check for either p2wsh or Taproot sigs in sanity checks (Antoine Poinsot)
e05039f67b3d7a44cd9079f3a57d75a3161cb3f1 spend: don't populate non_witness_utxo for Taproot (Antoine Poinsot)
8596ca76f3547c77cf64c556966ee1651550f231 bitcoind: compare descriptors, not their string representation. (Antoine Poinsot)
602c862118ff43616b24b5d252321a98a83d2454 bitcoind: sanity check min supported version for Taproot descriptor (Antoine Poinsot)
d3b7e4cc44c59b8aad77b0cf0d9ae29095db65f9 config: unit test a valid config with a Taproot descriptor (Antoine Poinsot)
6cf8eaab3b92a7f5bcc9c35490dc9766d071ca00 config: deser_from_str isn't descriptor specific. (Antoine Poinsot)
04f4b8a744cdcc52e345948ed9636640d641c528 descriptors: Taproot support (Antoine Poinsot)
c897d41965cf077fda63cc39c31cb75f400d757e descriptors: encapsulate key matching logic (Antoine Poinsot)
85fdc40366dcb3c5c8cf91be1b1cc59727402e04 descriptor: encapsulate PSBT in/out information update (Antoine Poinsot)

Pull request description:

  This introduces Taproot support in the Liana daemon / core library.

  We start by introducing support for `tr()` descriptors alongside `wsh()` descriptors in the Taproot modules. For Taproot-Liana descriptors whose primary spending path isn't a single key, we deterministically derive an unspendable internal key as per https://delvingbitcoin.org/t/unspendable-keys-in-descriptors/304/21. This is to allow signing devices to not display the internal key as a spendable key when verifying a descriptor. Currently signing device vendors signaled willingness to implement this scheme.

  We then adapt the PSBT management logic to use Taproot fields when necessary and upgrade the hot signer to provide Schnorr signatures depending on the PSBT information.

  Finally, the functional tests are adapted to be able to run the whole test suite under either P2WSH or Taproot. This is done in a somewhat hacky way as i bailed out of re-implementing a Taproot PSBT signer and finalizer in Python after implementing [TapMiniscript support in upstream python-bip380](https://github.com/darosior/python-bip380/pull/23). Instead we use a small Rust program to sign PSBTs for now and we skip a test which explicitly requires an external finalizer.

ACKs for top commit:
  darosior:
    ACK 4bb2372a63bb4b36ca9f0dd91d2373cff3e9e9a4 -- this underwent multiple rounds of review, Edouard tested it in his follow-up PR to the GUI and i wrote a couple fuzz targets exercising part of the logic introduced here

Tree-SHA512: 426032f0bcf8a27e43cf3d158da011bda648cb56534ea678d3c4a43c3f59047e4bb7f83469fd38f70ac962d1a9721e9c1f68baa60bf597bf08fa3c39fc00ebe8
2024-03-14 11:20:56 +01:00
Antoine Poinsot
b11dbfd6f5
Merge #996: gui: hint at rescan when importing wallet
492baeaabaf181523d0aac3ac1da8ce2ca837ece gui: hint at rescan when importing wallet (jp1ac4)

Pull request description:

  This is to resolve #866.

  I've added the message to the first step where the user enters the descriptor:

  ![image](https://github.com/wizardsardine/liana/assets/121959000/122c0476-79b5-4b0d-a711-73312a94dc01)

ACKs for top commit:
  edouardparis:
    ACK 492baeaabaf181523d0aac3ac1da8ce2ca837ece

Tree-SHA512: 7899ca979b2988d18e6d7be35bad4029db0f1c45f332739f779b532059a710be70463bb85167ffc04491dae35d9300e051788da92bd63ca67a301576b449ad8b
2024-03-13 19:23:27 +01:00
Antoine Poinsot
4bb2372a63
qa: drop specific value assertions in coin selection test
They don't add much value and cause flakiness because the size might sometimes be lower than that due to low-R signature grinding.

Fixes #1000.
2024-03-13 19:21:54 +01:00
Antoine Poinsot
7eb024afbc
fuzz: alternate between generating wsh() and tr() descs 2024-03-13 19:21:54 +01:00
Antoine Poinsot
b9a4625197
ci: run functional tests both under Taproot and P2WSH 2024-03-13 19:21:53 +01:00
Antoine Poinsot
687a0c2816
qa: adapt hardcoded coin selection tests to Taproot 2024-03-13 19:21:53 +01:00
Antoine Poinsot
ecef6bff5e
qa: functional tests lianad using Taproot descriptors
We introduce Taproot support in the test framework through a global
toggle. A few modifications are made to some tests to adapt them under
Taproot (notably the hardcoded fees / amounts).

This is based on my introduction of a quick and dirty support for
TapMiniscript in my python-bip380 library:
https://github.com/darosior/python-bip380/pull/23. In addition to this i
didn't want to implement a signer in the Python test suite so here we
introduce a simple Rust program based on our "hot signer" which will
sign a PSBT with an xpriv provided through its stdin and output the
signed PSBT on its stdout. Eventually it would be nicer to have a Python
signer instead of having to call a program.

The whole test suite should pass under both Taproot and P2WSH. Only a
single test is skipped for now under Taproot since it needs a finalizer
in the test suite.

I also caught a bug in the RBF tests which i fixed in place.
2024-03-13 19:21:52 +01:00
Antoine Poinsot
96d30db5b8
signer: taproot support in hot signer 2024-03-13 19:21:52 +01:00
Antoine Poinsot
80a7dc32aa
signer: move p2wsh signing into a dedicated function 2024-03-13 19:21:51 +01:00
Antoine Poinsot
d6222583be
command: also update Taproot sigs in 'updatespend' 2024-03-13 19:21:51 +01:00
Antoine Poinsot
714bd3c4ed
spend: check for either p2wsh or Taproot sigs in sanity checks 2024-03-13 19:21:50 +01:00
Antoine Poinsot
e05039f67b
spend: don't populate non_witness_utxo for Taproot 2024-03-13 19:21:50 +01:00
Antoine Poinsot
8596ca76f3
bitcoind: compare descriptors, not their string representation.
It's more robust and bitcoind serializes `wsh()` descriptors using `'`
as hardened marker and `tr()` descriptors using `h`..
2024-03-13 19:21:49 +01:00
Antoine Poinsot
602c862118
bitcoind: sanity check min supported version for Taproot descriptor
TapMiniscript support was only released in 26.0:
https://bitcoincore.org/en/releases/26.0
2024-03-13 19:21:48 +01:00
Antoine Poinsot
d3b7e4cc44
config: unit test a valid config with a Taproot descriptor 2024-03-13 19:21:48 +01:00
Antoine Poinsot
6cf8eaab3b
config: deser_from_str isn't descriptor specific. 2024-03-13 19:21:47 +01:00
Antoine Poinsot
04f4b8a744
descriptors: Taproot support
We introduce support for tr() descriptors alongside wsh() descriptors in
creating (compiling from policy, parsing from string) and working with
(analyizing its policy, getting spend information) a descriptor.

When compiling a Taproot descriptor, if no key from the policy could be
used as single internal key we deterministically generate an unspendable
internal key as per
https://delvingbitcoin.org/t/unspendable-keys-in-descriptors/304/21.
Similarly when lifting the policy of a Taproot descriptor, if the
internal key matches the deterministic unspendable key for this
descriptor we discard it from the analysis.

To fill information about an output for signers, we re-use
rust-miniscript PSBT input updated instead of re-inventing the wheel. It
does necessitate a hack however to use a type they would accept.

We don't change the "max size of a spending input" for now, even though
it means we would significantly overpay fees for descriptors with a
spendable internal key.
2024-03-13 19:21:47 +01:00
Antoine Poinsot
c897d41965
descriptors: encapsulate key matching logic
It will be useful when we introduce Taproot support in the next commit.
2024-03-13 19:21:46 +01:00
Antoine Poinsot
3bd9160d02
Merge #1003: Add default hint for hardware wallet errors
d2c4f136649c0a259b29531487737a50a2339be9 Add hint for hw errors (edouardparis)

Pull request description:

  Signing fails if another process has an open connection with a Ledger for example. Async-hwi needs to have a more detailed error api in order to handle graciously errors, but for now we provide a hint to what to check for the user

  close #381
  ![20240312_17h00m03s_grim](https://github.com/wizardsardine/liana/assets/6933020/6e5aff8c-d46f-4a44-a5e6-68d40e4d297c)

ACKs for top commit:
  jp1ac4:
    utACK d2c4f13664.

Tree-SHA512: 651c123e4f65af7080a6617062c98fb58f03b3b564c3bd104332eaa198b27242bda180118c996b46822b27168fabdd1ff422a9dfd2285db479f0332edc8908a4
2024-03-13 17:11:34 +01:00
Antoine Poinsot
85fdc40366
descriptor: encapsulate PSBT in/out information update
It'll make it easier to switch to update Taproot info.
2024-03-13 16:49:45 +01:00
edouardparis
a7b9718ddf
Merge #979: [GUI] fixed size/position for PSBT badges
e05e42136801e3168b99be378ae85e2852a8ccf6 refac ui: expose badge_pill width (edouardparis)
66f392c7543a013d0ba7eed8a3104538dd10f1f5 fixed size for badges (pythcoiner)

Pull request description:

  this PR try to fix #509
  i refactored some badges , moving (optional) `batch` badge before mandatory ones and give fixed positions/size for mandatory badges

  before:

  ![image](https://github.com/wizardsardine/liana/assets/124568858/02390bf1-d409-4854-a2bc-e9cf39aae53e)

  after:

  ![image](https://github.com/wizardsardine/liana/assets/124568858/38fee222-e0ee-42ad-a088-0ac449a6fa81)

ACKs for top commit:
  edouardparis:
    ACK e05e42136801e3168b99be378ae85e2852a8ccf6

Tree-SHA512: 9e7efa8aec40540255666350f2aea3f7175cb2fd161152e30335eb2a8b605ba5fa8fbac9cce90e7e3e53aab3ca71c8cc855ae8448ddfed337cf2eca2dc3d2e2a
2024-03-13 15:55:10 +01:00
edouardparis
e05e421368 refac ui: expose badge_pill width 2024-03-13 15:36:37 +01:00
jp1ac4
492baeaaba
gui: hint at rescan when importing wallet 2024-03-13 14:25:10 +00:00
Antoine Poinsot
f17092375e
Merge #1004: Fuzzing integration
3017b88e27849830530fc0ccf77df215889d17ba fuzz: fuzzing integrations, fuzz the descriptors module (Antoine Poinsot)
f7924fb9dcd4d91d404d1da736021f83619e2529 descriptors: lifting *can* fail (Antoine Poinsot)

Pull request description:

  This introduces fuzzing into our project with two fuzz targets exercising our descriptor parsing logic. See the commit messages for details. This found a crash (first commit).

  This was motivated by testing the work on Taproot (#985).

ACKs for top commit:
  darosior:
    ACK 3017b88e27849830530fc0ccf77df215889d17ba - it's not interfering with anything in the repo, been running these for half a day with no crash.

Tree-SHA512: 25c1b64a86585fc5f676c3526e2dae945b74c6b0cb4ce2d9db33dc48aa85aaa11a07b279838703d62c9ca00cf39cc34577ca19c0a8f9aaf5327266eb7be6dce0
2024-03-13 14:28:41 +01:00
Antoine Poinsot
3017b88e27
fuzz: fuzzing integrations, fuzz the descriptors module
This integrates fuzzing into our project by introducing two targets
which exercise the descriptor parsing and analysis logic.

The `descriptor_parse` is dead simple but not very effective. The
`descriptors` harness tries to be smarter by almost always generating a
valid Liana descriptor.

Of course, this is just a first integration and both could be made more
effective.
2024-03-13 12:02:51 +01:00
Antoine Poinsot
f7924fb9dc
descriptors: lifting *can* fail
Not sure what i was thinking when writing this.
2024-03-13 12:02:50 +01:00
edouardparis
d2c4f13664 Add hint for hw errors 2024-03-12 16:58:22 +01:00
Antoine Poinsot
8d33f49935
Merge #965: poller: unspend expired before new spend
cc1de1d6d6710f1426a957806661e7f3461a7cb5 poller: unspend coins before spending new (jp1ac4)
1e7653e08a3778446ff677bb147df68b734a31fd tests: add function to wait while condition holds (jp1ac4)

Pull request description:

  This change ensures that the spend txid of a coin is updated directly to another value in case a conflicting spend is detected.

  The previous order caused the spend txid to first be cleared, which would misleadingly make the coin appear as confirmed
  rather than spending.

  I've added a new utils function for the functional tests that is a slight generalisation of `wait_for` with an additional condition that must always be met while waiting.

  `wait_for` now calls this new function with the condition being one that is always true.

ACKs for top commit:
  darosior:
    ACK cc1de1d6d6710f1426a957806661e7f3461a7cb5

Tree-SHA512: e3f00804a63b0e94bc1b2cbee03cac63dd6e2555ca6d301589b356b2baf8e0cf27362e1dda44018d1d8282e300b187079fcf61f5d2754263b9e8b08cd34be06e
2024-03-12 08:47:41 +01:00
jp1ac4
cc1de1d6d6
poller: unspend coins before spending new
This change ensures that the spend txid of a coin is updated
directly to another value in case a conflicting spend is
detected.

The previous order caused the spend txid to first be cleared,
which would misleadingly make the coin appear as confirmed
rather than spending.
2024-03-11 15:41:17 +00:00
jp1ac4
1e7653e08a
tests: add function to wait while condition holds
This adds a new utils function that is a slight generalisation
of `wait_for` with an additional condition that must always be
met while waiting.

`wait_for` now calls this new function with the condition being
one that is always true.
2024-03-11 15:41:17 +00:00
Antoine Poinsot
87712ab043
Merge #988: installer: use -rpcauth for managed bitcoind
a997a7bcffac6eecbe472e383b7cb97bd2af738d gui: don't rely on cookie to check successful start (jp1ac4)
5e5c3330ee14159b14e43852d8db1d51a1b6bad8 gui: use rpcauth in installer for internal bitcoind (jp1ac4)
7584b6347bf6525d57d09596a60b4bdd2bccfb7f gui: start internal bitcoind with given config (jp1ac4)
b5980fbc4f6be006b083fbc8c7e4142e50598fb8 gui: add sections check to internal bitcoind config test (jp1ac4)
c3aad0f40c94ae86d1b14ff1b05178c0c043f732 gui: add optional rpcauth to internal bitcoind config (jp1ac4)
e172ecd2f1e910a5ba16ea4debb0091b70c2cb17 gui: move internal bitcoind config to bitcoind module (jp1ac4)

Pull request description:

  This is to resolve #929.

  The installer will generate an `rpcauth=` string for use in the managed bitcoind's bitcoin.conf file and will use the corresponding user and password in the Liana daemon config file.

  ~~The existence of the cookie file is still checked by `Bitcoind::start()` to determine if the process started successfully. An alternative approach could be considered in a follow-up PR (or as part of this one).~~

  For https://github.com/wizardsardine/liana/issues/924, we might still need to use the cookie path to stop an already-running process, as we would probably no longer have the password used to generate the previous `rpcauth=` string.

  Once https://github.com/wizardsardine/liana/pull/987 is merged, I'll update the Cargo files in this PR.

  In the first commit, I move some code from the installer to the bitcoind module. In the end, this wasn't strictly required for the other changes I made, but I kept it as I thought it made sense anyway.

ACKs for top commit:
  edouardparis:
    ACK a997a7bcffac6eecbe472e383b7cb97bd2af738d

Tree-SHA512: ec475bb3c82db4e30c42612e93c63e9b0387311a26d5433421f275e24ac5b0923eba9bd1daff612e60a6cf0bdcc10de0812ff69972237e6785c0835b5a31450f
2024-03-11 16:03:27 +01:00
jp1ac4
a997a7bcff
gui: don't rely on cookie to check successful start 2024-03-11 11:35:12 +00:00
jp1ac4
5e5c3330ee
gui: use rpcauth in installer for internal bitcoind 2024-03-11 11:35:12 +00:00
jp1ac4
7584b6347b
gui: start internal bitcoind with given config
This will allow bitcoind to start also in case of using rpcauth.

The cookie file is canonicalized in the installer beforehand
instead.

There is now no need for the config parameter to be mutable.
2024-03-11 11:35:12 +00:00
jp1ac4
b5980fbc4f
gui: add sections check to internal bitcoind config test 2024-03-11 11:35:11 +00:00
jp1ac4
c3aad0f40c
gui: add optional rpcauth to internal bitcoind config
With the updated liana dependency, we also need to pass `None` to
`list_spend_txs`.
2024-03-11 11:35:11 +00:00