344 Commits

Author SHA1 Message Date
Antoine Poinsot
f985fd7879
descriptors: remove as_inner method
We'll change the semantic of the descriptor, so we need to make sure
nothing accesses it with the old semantic.
2022-10-24 15:00:12 +02:00
Antoine Poinsot
846d924792
qa: upgrade python-bip380 to latest master
For multipath descriptors support
2022-10-24 15:00:11 +02:00
Antoine Poinsot
3105b86a28
Use my own fork of rust-miniscript
It supports multipath descriptors. We'll need to find a solution for the release
2022-10-24 09:01:03 +02:00
edouard
a623bd0f7a
Merge #70: bump minisafe#790d28
813b9684a90b2cf9b39d6e96c9d383d8d32ba5b8 bump minisafe#790d28 (edouard)

Pull request description:

ACKs for top commit:
  edouardparis:
    ACK 813b9684a90b2cf9b39d6e96c9d383d8d32ba5b8

Tree-SHA512: 8af937fdeac2e6d7df77cfd57eb5ab047d7babdedfbe9db67304b066c3779bb61806da24b0b5cba7c18fd8ee1df51a6258ea8df72f8ad608ddad9711c07d10be
2022-10-21 11:39:41 +02:00
edouard
813b9684a9 bump minisafe#790d28 2022-10-21 10:43:08 +02:00
Antoine Poinsot
790d283e77
Merge #67: Update rust-miniscript to 8.0.0
49ccc28ca7b0ee6e266d79ace67ff35c3d50905c Cargo: update most dependencies to the latest version (Antoine Poinsot)
a4bdb1efb79b8b87ba6131dea96798766e1fbcf5 tree wide: upgrade to Miniscript 8.0.0 (Antoine Poinsot)
d432745da583e2c38e67cae540b9417d76867bfa Cargo: don't require the 'compiler' feature from miniscript (Antoine Poinsot)
f7ca86191a6972bb6a8e3d78261159648db4ca23 ci: temporary disable 1.48 build on macOS (Antoine Poinsot)
f3e93df80c5f400e0b8f83c4862f0ff4b9f0f367 qa: add missing sighash type to dummy signatures in test_update_spend (Antoine Poinsot)

Pull request description:

  Took the opportunity to update some dependencies, too.

ACKs for top commit:
  darosior:
    ACK 49ccc28ca7b0ee6e266d79ace67ff35c3d50905c

Tree-SHA512: babd0ac6af752e4671b1221f63bcc85cf9f1029162893c71ba991b2da0c16bf02e70bf061969b1a058d7c22d57061d99a82d4ed8564787a38f8a35a784d21812
2022-10-20 18:17:04 +02:00
Antoine Poinsot
49ccc28ca7
Cargo: update most dependencies to the latest version 2022-10-20 17:53:27 +02:00
Antoine Poinsot
a4bdb1efb7
tree wide: upgrade to Miniscript 8.0.0
This also updates the indirect rust-bitcoin dependency to 0.29.

Major changes are in the descriptors management:
	- The rust-miniscript descriptors don't support raw hashes
	  within the pk_h() fragments, so we don't need all the boutique
	  management for this.
	- The key translator API changed.
	- We now take a u16 for the timelock instead of our previous
	  checks. This was inspired by the new rust-bitcoin Sequence
	  type.
	- We now take a path instead of just a derivation index in
	  DerivedKey. We might use paths after all...

As for rust-bitcoin it's just a few nits:
	- No more 'global' field on PSBTs (yay)
	- Couple more trait derivation on types
	- Some APIs were renamed.
2022-10-20 17:53:26 +02:00
Antoine Poinsot
d432745da5
Cargo: don't require the 'compiler' feature from miniscript 2022-10-20 17:53:26 +02:00
Antoine Poinsot
f7ca86191a
ci: temporary disable 1.48 build on macOS 2022-10-20 17:53:25 +02:00
Antoine Poinsot
f3e93df80c
qa: add missing sighash type to dummy signatures in test_update_spend 2022-10-20 16:37:47 +02:00
Antoine Poinsot
9732ce8e29
Merge #65: A new broadcastspend command
b89401e5835b94f7e5341028357b11db69f8e37d qa: remove an unused variable in test_update_spend (Antoine Poinsot)
af9f0aeaed0f5607db94348c136325cf5fe9e387 qa: replace our PSBT implementation with a tweaked version of Bitcoin Core's (Antoine Poinsot)
eff39ee35a4b4d9133586ab5200689da40ef254f rpc: a new 'broadcastspend' command (Antoine Poinsot)
37ee93a1e6ddd5089c1cc3d2cfa6f263b691cf32 commands: a new command for broadcasting a Spend transaction (Antoine Poinsot)
b14bc602d45cac8191059d8ed6a5391ca7cfc68f bitcoin: interface for broadcasting a transaction (Antoine Poinsot)

Pull request description:

  This implements a new command to broadcast an existing Spend transaction.

  Fixes #58.
  Fixes #66.

ACKs for top commit:
  darosior:
    ACK b89401e5835b94f7e5341028357b11db69f8e37d

Tree-SHA512: 299f7ba1df48ff2bbda68055df885474f5ca2b8336c46403d5f0bdfc30ec66d52653615780c187c8cab23b756fd9dad97f02c7ac20c71d833c54183d3c2e5f0a
2022-10-19 15:55:54 +02:00
edouard
382962a47b
Merge #26: Add coins panel
b849f9bb3d8577f6a0c52e6903842ab72d602583 Update minisafe master (edouard)
86eddb28c625a96a0e9b3db7cc80dbb3eb0813f5 add coins panel to gui (edouard)

Pull request description:

  based on #22

ACKs for top commit:
  edouardparis:
    Self-ACK b849f9bb3d8577f6a0c52e6903842ab72d602583

Tree-SHA512: 9959ecd84594ce94c3c9ae383344615b533a1dc968268cb8a8336840750a9c6ee82ab29a7f45999e5d27ab79a296dd2396a0d9e56890f7063c38717e0f0f6391
2022-10-19 13:37:23 +02:00
edouard
b849f9bb3d Update minisafe master 2022-10-19 12:56:44 +02:00
edouard
86eddb28c6 add coins panel to gui 2022-10-19 12:56:44 +02:00
Antoine Poinsot
b89401e583
qa: remove an unused variable in test_update_spend
The new PSBT implementation brought it to light.
2022-10-19 12:07:22 +02:00
Antoine Poinsot
af9f0aeaed
qa: replace our PSBT implementation with a tweaked version of Bitcoin Core's
This replaces our existing implementation of PSBTs with a more
straightforward one, adapted from the Bitcoin Core functional tests
framework. This fixes a few flakes that occured because the previous
implementation could produce invalid PSBTs.

The Bitcoin Core implementation is pretty low level and was adapted to
treat mappings as such (the value in the PSBTMap can itself be a
mapping, like for partial signatures or BIP32 derivation paths).

The rest of the diff is adapting the users of PSBT to use the new
implementation and the clearly superior interface (yay!).
2022-10-19 12:07:22 +02:00
Antoine Poinsot
eff39ee35a
rpc: a new 'broadcastspend' command 2022-10-18 19:54:03 +02:00
Antoine Poinsot
37ee93a1e6
commands: a new command for broadcasting a Spend transaction 2022-10-18 19:48:37 +02:00
Antoine Poinsot
b14bc602d4
bitcoin: interface for broadcasting a transaction 2022-10-18 19:48:20 +02:00
Antoine Poinsot
9bb20303e7
Merge #63: Chain reorganization handling
e75637d3629df901b1aa453b131c1c780bfd8724 jsonrpc: fixup two typos in error messages (Antoine Poinsot)
a9b0e5e559b0ddddbd8e612771a95182f131e0f0 qa: functional tests for block chain reorganization (Antoine Poinsot)
e88bbbe65b34cf7af645fc3f07a90266d4a66792 poller: block chain reorganization handling (Antoine Poinsot)
d6f24e1c6a20d961128aa9c95367bd62aa8cb229 bitcoind: don't return spent coins with unfetchable spending tx as spent (Antoine Poinsot)
99ab0d7add5f9f3f924a6bd61263135c09e2a4cc commands: add a 'spend_info' field to the 'listcoins' entries (Antoine Poinsot)
57add1d86bb734b0f5291b2f266ef5652c93bc8d commands: return the DB's block height in 'getinfo' (Antoine Poinsot)
92f7ef12251309a30d100108ad82cd6790b5f4ac commands: make listcoins return all coins by default (Antoine Poinsot)
e9e4acd69de55e0c32c7e275e3b5318b5e161c46 db: database interface to rollback to a previous best block (Antoine Poinsot)
972c8dac86976723f4c417142999d4850c2fb9b6 db: require the spend block height from the DB interface (Antoine Poinsot)
6038843d33621c098d958d343c8b6d038922f72f database: rename coins' spent_at in spend_block_time (Antoine Poinsot)
cce227f80fbcbb32c5fca6fe78142131d7f35a53 bitcoin: interface to get the common block in our and the backend's chains (Antoine Poinsot)

Pull request description:

  This finally implements our reorganization handling. Like in revaultd, upon noticing a tip change that indicates a reorg happened in our Bitcoin backend we rollback our state to the common ancestor between our state and the new chain, then start rescanning from there. The logic is much more straightforward than in revaultd though, as there is no presigned transactions to care about.

  The PR grew a bit large as this needed a bit of preparatory work in order to be reasonably tested (and i noticed a few bugs and cleanups that slipped through review in #29). Please let me know if reviewers prefer that i split the prep work on the commands in another PR.

  Fixes #15.

ACKs for top commit:
  darosior:
    ACK e75637d3629df901b1aa453b131c1c780bfd8724

Tree-SHA512: 1ebb2a3e10b462b739e1d5cb831de946177436c8fad4dcb20eb575fd0f58bef98a86e25c5fe0ed07d946975f982a420940607a69e74f24a02ef16271c92eceba
2022-10-18 19:44:56 +02:00
Antoine Poinsot
e75637d362
jsonrpc: fixup two typos in error messages 2022-10-18 19:43:52 +02:00
Antoine Poinsot
a9b0e5e559
qa: functional tests for block chain reorganization 2022-10-18 19:15:55 +02:00
Antoine Poinsot
e88bbbe65b
poller: block chain reorganization handling 2022-10-18 19:15:54 +02:00
Antoine Poinsot
d6f24e1c6a
bitcoind: don't return spent coins with unfetchable spending tx as spent
It seems less bad to be able to check again at the next poll.
2022-10-18 19:15:54 +02:00
Antoine Poinsot
99ab0d7add
commands: add a 'spend_info' field to the 'listcoins' entries 2022-10-17 11:47:42 +02:00
Antoine Poinsot
57add1d86b
commands: return the DB's block height in 'getinfo'
It makes more sense than to return the Bitcoin backend's. And it's helpful to wait for sync in functional tests.
2022-10-17 11:47:41 +02:00
Antoine Poinsot
92f7ef1225
commands: make listcoins return all coins by default
We'll add some parameters to filter by status and/or outpoints later on.
But for now also list coins that were spent or are being spent.
2022-10-17 11:47:41 +02:00
Antoine Poinsot
e9e4acd69d
db: database interface to rollback to a previous best block 2022-10-17 11:47:40 +02:00
Antoine Poinsot
972c8dac86
db: require the spend block height from the DB interface
Hence add a 'spend_block_height' field to the 'coin' column in the
SQLite implementation. This also contains a couple cleanups, as well as
a fix (we were still checking if the blockheight was > 1).
2022-10-17 10:44:38 +02:00
Antoine Poinsot
6038843d33
database: rename coins' spent_at in spend_block_time 2022-10-17 10:27:03 +02:00
Antoine Poinsot
cce227f80f
bitcoin: interface to get the common block in our and the backend's chains
This will be used to get the common ancestor in the chain upon detecting
a block chain reorganization.
2022-10-17 10:26:23 +02:00
Antoine Poinsot
efe2cf634d
Merge #60: Clippification
7e911b8bb7ccca866db2afadb357615d3712a4cb ci: add Clippy check for both the daemon and the GUI (Antoine Poinsot)
6871407b1a2514c8c3b259a88cd5c267b206761e gui: clippification (Antoine Poinsot)
8b4866158bc2097a14857194d38bfb058678a55b daemon: clippification (Antoine Poinsot)

Pull request description:

  This fixes *all* clippy warning from the whole repository. Some of them are... Well very opinionated to say the least. But to avoid bikeshedding i just applied all of them. Let's start fresh!

  @edouardparis can you skim through the clippy fixes in the GUI folder? I checked the daemon one already.

  Fixes #10.

ACKs for top commit:
  edouardparis:
    ACK 7e911b8bb7ccca866db2afadb357615d3712a4cb

Tree-SHA512: acebc86425039511d090b58139e12c149463d7a288d0d2aed3ba75d303aa2034db65f39f7e00436d556e86aa382686acab6699e65afe10ea31238c0a48a0635c
2022-10-14 12:31:20 +02:00
Antoine Poinsot
7e911b8bb7
ci: add Clippy check for both the daemon and the GUI 2022-10-13 14:24:25 +02:00
Antoine Poinsot
6871407b1a
gui: clippification 2022-10-13 14:24:25 +02:00
Antoine Poinsot
8b4866158b
daemon: clippification
That's a minimal API break because of some error variants that were
Box'd.
2022-10-13 14:24:24 +02:00
Antoine Poinsot
2a3214460e
Merge #29: Check spend status in bitcoin poller
172cda19a0a72b77e3832f2e29ed7ff6f8062c44 bitcoin: avoid an unnecessary large clone() (Antoine Poinsot)
7513bcbf09f13f1625b989d52c52087048d90a73 bitcoind: use and_then instead of map().flatten() (Antoine Poinsot)
51f11a9e2f51945c7ec1f59a9acfd43d2f3977d3 looper: cleanup the check for spending coins' confirmation (Antoine Poinsot)
c9b6c6dedbc1e28b05543191238d0a81a92ba238 db: re-rename list_unspent_coins into unspent_coins (Antoine Poinsot)
3534e35b8721c5026b27d4d3c07b87dc6e4fa3dd bitcoin: remove erroneous block height check (Antoine Poinsot)
bb9897bdbb9926f6c3f8d9fb95339e45546372e2 Update coin txid if conflicting tx was confirmed (edouard)
3cf6bcbb98fc0034bc46ed58564e8aa4a1b6ffa6 add spent_coins to bitcoind poller (edouard)
94ee94edbdcdd917df131ad87893406f5f8597a2 Add blocktime and spent_at to coins table (edouard)

Pull request description:

  Add two new columns:

  - `blocktime`: timestamp of the block containing the transaction funding the coin.
  - `spent_at`: timestamp of the block containing the transaction spending the coin.

  Update the coin `spent_at` when the spend transaction is confirmed

ACKs for top commit:
  darosior:
    ACK 172cda19a0a72b77e3832f2e29ed7ff6f8062c44

Tree-SHA512: 4f12dd273784c1e8fab7f6427800fd10e6404d47e07e2293106d4454165dffb856cd65c5f4e4537867be403bd1790ce363968bfb94fec58ab02af3624ed68f22
2022-10-12 17:27:46 +02:00
Antoine Poinsot
172cda19a0
bitcoin: avoid an unnecessary large clone() 2022-10-12 17:25:56 +02:00
Antoine Poinsot
7513bcbf09
bitcoind: use and_then instead of map().flatten() 2022-10-12 17:25:22 +02:00
Antoine Poinsot
51f11a9e2f
looper: cleanup the check for spending coins' confirmation 2022-10-12 17:24:27 +02:00
Antoine Poinsot
c9b6c6dedb
db: re-rename list_unspent_coins into unspent_coins 2022-10-12 17:19:27 +02:00
Antoine Poinsot
3534e35b87
bitcoin: remove erroneous block height check 2022-10-12 17:17:45 +02:00
edouard
bb9897bdbb Update coin txid if conflicting tx was confirmed 2022-10-05 17:41:16 +02:00
edouard
3cf6bcbb98 add spent_coins to bitcoind poller 2022-10-05 17:41:16 +02:00
edouard
94ee94edbd Add blocktime and spent_at to coins table
Spent coins are coins where spent_txid and spent_at
are both not null.
2022-10-05 17:41:16 +02:00
Antoine Poinsot
ac6e0443ea
Merge #30: Spend transactions listing and deletion
c73e8a42dd050c1e24daf295c666f6aa625f3bee commands: add a new 'delspendtx' command (Antoine Poinsot)
d5bd10add8270c1e0aae1855e6f8a96649323e24 commands: add a change_index field to listspendtxs entries (Antoine Poinsot)
c6e004806aecef54c640119439406b5308fbacd0 commands: add a 'list_spend' command (and 'listspendtxs' RPC) (Antoine Poinsot)

Pull request description:

  Based on #27 this implements listing and deletion of Spend transaction from database. The API was based off revaultd's one and @edouardparis' suggestions in #1. We could be smarter in various places but at the moment we KISS.

ACKs for top commit:
  darosior:
    ACK c73e8a42dd050c1e24daf295c666f6aa625f3bee

Tree-SHA512: d4a13b9cbc9a6d48f698ba2f113c5de116b17cc51ed1f8dba578c041d9a70249699627729562ea199b32db6aaa9d2eb973d2b890f35a5e398e9c34940701ea86
2022-10-04 02:06:00 +02:00
Antoine Poinsot
9c787d061d
Merge #27: Spend transactions creation and storage
3dfc7261db33a4db85772dfa9db5f61f8d8952e2 jsonrpc: a new 'updatespend' RPC (Antoine Poinsot)
cf45ba0fa5ead02997f1ffe7fea4faf83894ec8d commands: add a new 'update_spend' command (Antoine Poinsot)
bafcadf39870c02b89a9a4627a6918fce6c54f30 db: interface to upsert a Spend PSBT and query it by txid (Antoine Poinsot)
7d015bcf435897fa6e129b931fd2bea742ff7bc5 jsonrpc: add a 'createspend' RPC command (Antoine Poinsot)
7468a7fcfb37736c4585d16c091fb5db68bf50cc qa: add PSBT and transaction serialization to the test framework (Antoine Poinsot)
09f59c417ba04a153887a7cdf1e284703c9647aa qa: fix the UDS class' forwarding method calls as JSONRPC calls (Antoine Poinsot)
9afd44061e12c4b50720571d7e6aa0c260e725eb commands: add a new create_spend command (Antoine Poinsot)
12188f0c52d5ab141c1dcea194851ba01c04a57d descriptors: add more utilities to the derived descriptor type (Antoine Poinsot)
46320d5fc09371d1657044fd1a8507e919bcaff4 db: an interface to query coins by their outpoints (Antoine Poinsot)

Pull request description:

  This implements two new commands to create and store a Spend transaction PSBT. We'll need a `listspendtxs` and `delspendtx` eventually as in `revaultd`.

  This has poor change management (address reuse for simplicity). I was thinking of using odd/even indexes to differentiate receive/change addresses before we have [multi-path descriptors](https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-July/020791.html). Now i wonder if it makes sense at all to implement this odd/even thing and just stick with address reuse before multi-paths descriptors. Nobody is supposed to use that anyways.

ACKs for top commit:
  darosior:
    ACK 3dfc7261db33a4db85772dfa9db5f61f8d8952e2

Tree-SHA512: 7f148c4d0d9ff8054c6405ca3031c2629c79917cdbf0134949ce7e066fa5aa157eb5bbe823d56a165a14c946d72c615d7dafa920899ba21d8471cc935c14790b
2022-10-04 01:54:09 +02:00
Antoine Poinsot
2397b4a889
Merge #31: ci: add a Cirrus configuration for the functional tests
24cf9645e0897ab880949813daceac07ddb67234 ci: add a Cirrus configuration for the functional tests (Antoine Poinsot)

Pull request description:

  Taken and adapted from revaultd.

  Now that 24.0rc1 of Bitcoin Core is released we can actually have a CI for functional tests.

  Fixes #14.

ACKs for top commit:
  darosior:
    ACK 24cf9645e0897ab880949813daceac07ddb67234

Tree-SHA512: d1157fc6caf507c6507a2c73df02b097c9e2f1b8ecb2330f8b2f65ffe8a368e7d6265a9d0538c5c9ed3623df6fd03f49dff259bdd0019784008106f392e0ab0b
2022-10-01 16:44:38 +02:00
Antoine Poinsot
24cf9645e0
ci: add a Cirrus configuration for the functional tests
Taken and adapted from revaultd.
2022-10-01 15:30:59 +02:00
Antoine Poinsot
c73e8a42dd
commands: add a new 'delspendtx' command 2022-10-01 14:05:27 +02:00