89 Commits

Author SHA1 Message Date
Antoine Poinsot
7d015bcf43
jsonrpc: add a 'createspend' RPC command
Since the Spend transaction command requires some parameters, this
implements the parameter-getting logic on the JSONRPC side as well.

This allows us to implement an end-to-end functional test of the
transaction flow using an external way to broadcast it. From the input
coins creation, to the Spend transaction broadcast.
2022-09-15 11:41:33 +02:00
Antoine Poinsot
7468a7fcfb
qa: add PSBT and transaction serialization to the test framework
Copied it from revaultd.
2022-09-15 11:41:32 +02:00
Antoine Poinsot
09f59c417b
qa: fix the UDS class' forwarding method calls as JSONRPC calls
We weren't passing arguments if they were a list!
2022-09-15 11:41:32 +02:00
Antoine Poinsot
9afd44061e
commands: add a new create_spend command 2022-09-15 11:41:31 +02:00
Antoine Poinsot
12188f0c52
descriptors: add more utilities to the derived descriptor type
We'll need those to add them to PSBTs we create.
2022-09-15 11:41:30 +02:00
Antoine Poinsot
46320d5fc0
db: an interface to query coins by their outpoints 2022-09-15 11:41:29 +02:00
edouard
dab40527ae
Merge #17: Typesafe descriptor management
ee86a1bd5ebbda39885f1e8869bf8ae03552d682 descriptors: add a helper to get the value of the timelock (Antoine Poinsot)
0fd57db8a893ae2621ca5f3cc03c6393c3a65646 Use the descriptor newtype instead of the raw miniscript Descriptor type (Antoine Poinsot)
44eb0fad9b758f7b81caea735b1a6ea41b29ebd6 descriptors: introduce a newtype for derived descriptors (Antoine Poinsot)
869d370daa354c76292517448646d0b7f76facba descriptors: introduce an InheritanceDescriptor type (Antoine Poinsot)

Pull request description:

  This introduces types for our inheritance descriptor. This is taken and adapted from revaultd, where it turned out to be very helpful.

  This also adds a helper to query the timelock of the heir's spending path in the inheritance descriptor for downstream users to be able to compute the expiration block of each coin.

  This is based on #13.

ACKs for top commit:
  edouardparis:
    utACK ee86a1bd5ebbda39885f1e8869bf8ae03552d682

Tree-SHA512: 948720967052fcd0e83c3f061f981b25d79c4cc62bbd521de5ea27ee0f08ed1c50c3c089c9cb0729e1bdc59f4acfed1fa05decdbe4fd8b549abd3345c34d66a5
2022-09-15 09:43:35 +02:00
edouard
f5387f7ed9
Merge #22: gui: Home and Receive panels
7f9fd84beead64ef8fe259f1174e01cbc0dd4cfa Add balance to panel home (edouard)
157d9b39333e9eae1b1fc231bc6abd2f6661bca6 Add coins to cache (edouard)
f32b4d52d2facf409d73b8e27a67d05e13255373 daemon: add list_coins method (edouard)
647b74ebcf789e8df7bf530e83258a3a38286be9 Add unit test for receive panel state (edouard)
ebc239733c3a508f08f5539a862d3029d45c753f Add sandbox and daemon mock to utils mod (edouard)
928294b32e2afa0ae4472817f8bbb1e477b8afdb Add receive panel (edouard)
1026d2b487c3f0d9955b93d1cf1b79a0a8ad94bf Add get_new_address to daemon trait (edouard)
2286a19e20cfde07d4c7eb4bdd3190abea3a09d1 Update minisafe master:#4a802890 (edouard)

Pull request description:

ACKs for top commit:
  edouardparis:
    Self ACK 7f9fd84beead64ef8fe259f1174e01cbc0dd4cfa

Tree-SHA512: b0c0b89540ede0f7f895197595af8b97fa515d5e4b6b7f3dcd4e29b02bfcb0a9ce338f3ee5644e486892ab132c456fca29ad4189a3f71f6420f535f99dbe77ba
2022-09-07 15:25:10 +02:00
edouard
7f9fd84bee Add balance to panel home 2022-09-07 15:12:08 +02:00
edouard
157d9b3933 Add coins to cache 2022-09-07 15:12:08 +02:00
edouard
f32b4d52d2 daemon: add list_coins method 2022-09-07 15:12:08 +02:00
edouard
647b74ebcf Add unit test for receive panel state 2022-09-07 15:12:08 +02:00
edouard
ebc239733c Add sandbox and daemon mock to utils mod 2022-09-07 15:12:08 +02:00
edouard
928294b32e Add receive panel 2022-09-07 15:12:08 +02:00
edouard
1026d2b487 Add get_new_address to daemon trait 2022-09-07 15:12:08 +02:00
edouard
2286a19e20 Update minisafe master:#4a802890 2022-09-07 15:12:08 +02:00
edouard
4a80289063
Merge #23: gui: fix clippy errors and wrong title
baa87375d046046478bc9195ff4802518a3247d3 fix windows title and doc (edouard)
b77d331792923eb0dc1bad7dd67e565698ef93c1 fix clippy errors (edouard)

Pull request description:

ACKs for top commit:
  edouardparis:
    ACK baa87375d046046478bc9195ff4802518a3247d3

Tree-SHA512: c9cefb39664512c0618422710e5d9d0e6a980f5a724d1e0f62cc2269f7520db8fc5529102e236c3ac3624a742da74864986e6766b19e015b7f058cde2b6956f5
2022-09-06 09:10:35 +02:00
edouard
baa87375d0 fix windows title and doc 2022-09-05 18:36:33 +02:00
edouard
b77d331792 fix clippy errors 2022-09-05 18:34:45 +02:00
Antoine Poinsot
3d427713e1
Merge #13: Coin tracking
9d0c68dae34f96a96d318f75cbbb5dbefffdd3d8 commands: add a 'list_coins' command. (Antoine Poinsot)
99a9cbf0f83fda6f98892c23ac89324f04b650ff poller: query derivation index by address from DB (Antoine Poinsot)
3f17e9f0c32db9724b384b9bd58c097653e9d04f database: change interface from update_der_index to increment_der_index (Antoine Poinsot)
e74ea4c2d36d17d0aa05044991d2cfff311d9f37 sqlite: a table for a mapping from address to derivation index. (Antoine Poinsot)
c9ef068fa5cb0ec39a9a88ec581434f6abb84048 poller: update our coins on each poll (Antoine Poinsot)
c6a25adfcdd371a1a2581cc210fb4dc03dfced2d bitcoin: interface for coins discovery and updates (Antoine Poinsot)
05b3af1b5a9faaa54106e11f87e38b391ebff744 database: interface and implementation for coins storage and update (Antoine Poinsot)

Pull request description:

ACKs for top commit:
  edouardparis:
    ACK 9d0c68dae34f96a96d318f75cbbb5dbefffdd3d8

Tree-SHA512: 0087ff04939326ae7affbb4c0defbe5573fc58d15f4b2fb47a71a03880187c4105742cc9eda868c3fe0ee5890931dc57eb3c63b4ef79335f434771d5cc089483
2022-08-25 10:29:50 +02:00
edouard
4e26f18bc2
Merge #19: Gui settings
29e134748df363963092e16dcd288ed6431d7434 Add settings panel to gui (edouard)

Pull request description:

  based on #8

ACKs for top commit:
  edouardparis:
    ACK 29e134748df363963092e16dcd288ed6431d7434

Tree-SHA512: 7a09c00d53ddef091219ffe5bf702795171bc0575b55f4930680a251d712d8cfdf30afd1ad38218c01c8430346fe95625202eb30b8cb9e1190d40806a7e6d226
2022-08-24 17:30:07 +02:00
edouard
29e134748d Add settings panel to gui
Remove context module for a cache module.
2022-08-24 12:00:24 +02:00
edouard
f45b3ecc43
Merge #8: gui: loader and installer
88bfe974d0deea456c03c97cb17495d0b5d9109e Add dashboard view (edouard)
55373eadebe5e69e8832ce140032f2a71a012ee9 github ci: add gui (edouard)
0b24104b4546aedacea6953617825956f1642245 gui: installer and loader (edouard)

Pull request description:

  Wait before merging

ACKs for top commit:
  edouardparis:
    ACK 88bfe974d0deea456c03c97cb17495d0b5d9109e

Tree-SHA512: e290118f18634671b10847b00c84dd18b5a1df43522ae3277306e6957015d332d4f86b388e5a7e0c667d7462c47a3baec0c26954b86e7e59b904aaa95c0bd4de
2022-08-23 10:38:03 +02:00
edouard
88bfe974d0 Add dashboard view 2022-08-22 17:19:08 +02:00
edouard
55373eadeb github ci: add gui 2022-08-22 17:19:08 +02:00
edouard
0b24104b45 gui: installer and loader 2022-08-22 17:19:08 +02:00
Antoine Poinsot
ee86a1bd5e
descriptors: add a helper to get the value of the timelock 2022-08-18 12:02:27 +02:00
Antoine Poinsot
0fd57db8a8
Use the descriptor newtype instead of the raw miniscript Descriptor type 2022-08-18 12:02:27 +02:00
Antoine Poinsot
44eb0fad9b
descriptors: introduce a newtype for derived descriptors 2022-08-18 12:02:26 +02:00
Antoine Poinsot
869d370daa
descriptors: introduce an InheritanceDescriptor type
We check it when creating it either from material or from string.
2022-08-18 12:02:26 +02:00
Antoine Poinsot
9d0c68dae3
commands: add a 'list_coins' command. 2022-08-18 12:01:27 +02:00
Antoine Poinsot
99a9cbf0f8
poller: query derivation index by address from DB 2022-08-18 12:01:26 +02:00
Antoine Poinsot
3f17e9f0c3
database: change interface from update_der_index to increment_der_index
And take care of updating the (addr->index) mapping in the SQLite implementation.
2022-08-18 12:01:26 +02:00
Antoine Poinsot
e74ea4c2d3
sqlite: a table for a mapping from address to derivation index. 2022-08-18 12:01:25 +02:00
Antoine Poinsot
c9ef068fa5
poller: update our coins on each poll
This refactors the entire state update on each poll, to apply database
changes at the very end.
2022-08-18 12:01:25 +02:00
Antoine Poinsot
c6a25adfcd
bitcoin: interface for coins discovery and updates 2022-08-18 12:01:24 +02:00
Antoine Poinsot
05b3af1b5a
database: interface and implementation for coins storage and update 2022-08-18 12:01:24 +02:00
Antoine Poinsot
b548451292
Merge #11: JSONRPC2 server
798bf67e21977ad18ee680a14e23e534f64a3ea5 commands: derive Deserialize for commands results (Antoine Poinsot)
fe5de96312dc8d57f982c060d4b9b045c2194163 Shorten the paths to the dummy datadirs in the unit tests (Antoine Poinsot)
069bca546a23ce1b1714b9564973f13a6f090536 jsonrpc: don't use a Mutex to share the DaemonControl between threads (Antoine Poinsot)
e6fcdd5b095232729cbeef4bd42bf6e57d77ffde jsonrpc: don't umask in unit tests (Antoine Poinsot)
14bd3890dcf6c5dc9fbe25992710c80c9ff107c7 doc: add an API.md documenting the JSONRPC API. (Antoine Poinsot)
eeac67dc0a7724ef4ca9003b7e734f546e62c0ae qa: shut down the daemon via the JSONRPC interface at teardown (Antoine Poinsot)
726209cc0a07d12c71041573313d5b34def30bbd jsonrpc: add a 'stop' command (Antoine Poinsot)
d03c46996798d9e5d68858c4d4631e6b3295f9b3 Introduce a testutils module with a DummyMinisafe for unit tests (Antoine Poinsot)
e510c0a30dd18445d595e403d5cddd8fe04ef1b6 config: separate the Bitcoin and bitcoind-specifc settings (Antoine Poinsot)
ea3595349d0051912ce187ca27de7a6df9b6e7e6 Accept a custom database interface when starting the daemon (Antoine Poinsot)
f365effacd12d0d3fce105dbc59e7ccf5f85488c Accept a custom Bitcoin interface when starting the daemon (Antoine Poinsot)
93098be7dcb82808f6644eee97005c6607eb0cda tests: implement the connection to the daemon's RPC server (Antoine Poinsot)
0d55d6c45599c2a4996f10c5066041369c06d9b1 jsonrpc: a simple JSONRPC2 server (Antoine Poinsot)
dd1b353a36feb04b1af5553e9c71763957996af0 commands: derive serde::Serialize for results (Antoine Poinsot)
86c1d32662e7fda9887da5f799e42cce73228448 bitcoin: name the Bitcoin poller thread (Antoine Poinsot)
6b2e90181484d5dd0ed4ee23b78ab705d98b5c36 bit poller: fix a off logged percentage (Antoine Poinsot)
6ff43fcd9543acb79d6f4c343e102f5029f5480f daemon: log the name of the current thread, too. (Antoine Poinsot)
a067daf16b99a8bdaad1034f2e539c60108a1b4a tests: use a ranged descriptor (Antoine Poinsot)
5228ee370bad72efd98d27e2181fb1ee1c27bae2 tests: remove mistakenly committed file (Antoine Poinsot)

Pull request description:

  On top of #9, this introduces a simple JSONRPC server calling into the exposed commands. I started by reusing code from revaultd, but ended up rewriting it entirely. Compared to it, it t is simpler, smaller and dependency-less.

  In order to sanity check the whole server startup and teardown in unit tests, this took a detour by introducing a `testutils` module with mocked Bitcoin and database interfaces. Those will be useful later.

  This introduces a JSONRPC-specifc command: `stop`, which shuts down the daemon. We add a `doc/API.md` adapted from #1 with documentation for the existing commands.

ACKs for top commit:
  darosior:
    self-ACK 798bf67e21977ad18ee680a14e23e534f64a3ea5 -- tested using following PRs #13 and #17.

Tree-SHA512: 2eb07c29904e1f71f7375aa5729d5f3bfc5649627a92ef6e49dd273f91a8d4c4243b495eb87d09fa44198ef125066161cf6a2c86af14b4135d806c8baca217b2
2022-08-18 12:00:50 +02:00
Antoine Poinsot
798bf67e21
commands: derive Deserialize for commands results 2022-08-17 19:40:00 +02:00
Antoine Poinsot
fe5de96312
Shorten the paths to the dummy datadirs in the unit tests
It failed CI on MacOS because of overflowing SUN_PATH_LEN.
2022-08-17 19:40:00 +02:00
Antoine Poinsot
069bca546a
jsonrpc: don't use a Mutex to share the DaemonControl between threads 2022-08-17 19:39:59 +02:00
Antoine Poinsot
e6fcdd5b09
jsonrpc: don't umask in unit tests
It can interfere with the creation of dummy directories in other threads and cause spurious errors
2022-08-17 19:39:59 +02:00
Antoine Poinsot
14bd3890dc
doc: add an API.md documenting the JSONRPC API.
Co-Authored-By: Edouard Paris <m@edouard.paris>
2022-08-17 19:39:58 +02:00
Antoine Poinsot
eeac67dc0a
qa: shut down the daemon via the JSONRPC interface at teardown 2022-08-17 19:39:58 +02:00
Antoine Poinsot
726209cc0a
jsonrpc: add a 'stop' command
This also implements a simple JSONRPC server sanity check

And introduces a new tmp_dir() test utility, that i didn't have the courage to split from this commit
2022-08-17 19:39:57 +02:00
Antoine Poinsot
d03c469967
Introduce a testutils module with a DummyMinisafe for unit tests
So we can have unit tests without a dummy bitcoind thread, as we
currently do for the startup test.

This commit also implements sanity checks for the two existing commands
using this mechanism.
2022-08-17 19:39:56 +02:00
Antoine Poinsot
e510c0a30d
config: separate the Bitcoin and bitcoind-specifc settings 2022-08-17 19:39:56 +02:00
Antoine Poinsot
ea3595349d
Accept a custom database interface when starting the daemon 2022-08-17 19:39:55 +02:00
Antoine Poinsot
f365effacd
Accept a custom Bitcoin interface when starting the daemon
The Bitcoin interface was thought of as being generic, but a caller
couldn't use one different from bitcoind. Make it so they can, and fix
our trait and generics implementations.
2022-08-17 19:39:55 +02:00
Antoine Poinsot
93098be7dc
tests: implement the connection to the daemon's RPC server
And add some basic sanity check of the existing commands.
2022-08-17 19:39:54 +02:00