Sergi Delgado Segura
7a5a73e9bd
Merge pull request #94 from sr-gi/improve-cli
...
Improve cli
2020-02-11 22:48:39 +01:00
Sergi Delgado Segura
036f879302
Monkeypatches load_keys in e2e tests since add_appointment calls it internally
2020-02-11 22:31:14 +01:00
Sergi Delgado Segura
ea4d6cf345
Updates e2e tests to derive pk from sk intead of using load_keys
...
Since we're creating a new set of keys in the e2e tests the hardcoded public key of the cli won't work
2020-02-11 21:55:02 +01:00
Sergi Delgado Segura
afcada03bf
Improve docs
2020-02-11 20:24:03 +01:00
Sergi Delgado Segura
d447debe54
Temporal fix for Cryptographer logs. Close #91
2020-02-11 20:22:51 +01:00
Sergi Delgado Segura
e2794eff2a
Modifies e2e tests to match alpha cli.load_keys
2020-02-11 19:27:33 +01:00
Sergi Delgado Segura
22ded55990
Renames pisa_cli to wt_cli
2020-02-11 18:37:12 +01:00
Sergi Delgado Segura
f492fe7cbb
Updates e2e tests to use new cli methods
2020-02-10 16:31:51 +01:00
Sergi Delgado Segura
dd232c678a
Updates default cli.log name
2020-02-10 16:31:51 +01:00
Sergi Delgado Segura
ee4269d047
Updates cli tests and adds some missing ones
2020-02-10 16:31:51 +01:00
Sergi Delgado Segura
5a49a93710
Improves cli
...
- Improves modularity
- Adds missing exceptions
- Adds docstrings
- Simplifies some method names
2020-02-10 16:31:50 +01:00
Sergi Delgado Segura
ab21cbfc8f
Moves load_key_file to Cryptographer and updates pisad to use it
2020-02-10 16:31:48 +01:00
Sergi Delgado Segura
4ea6450c0e
Merge pull request #93 from sr-gi/remove-sleep
...
Remove sleep
2020-02-10 16:27:23 +01:00
Sergi Delgado Segura
6913d1cd18
Update tests to remove the asleep flags
2020-02-10 16:21:31 +01:00
Sergi Delgado Segura
a4f7548804
Removes sleep flag and reorders code for redability
2020-02-10 16:21:05 +01:00
Sergi Delgado Segura
aa12fa2cf8
Removes sleep flag from Watcher and Responder
...
The sleep flag was used to avoid doing useless work when no data was hold by the tower. However, from the implementation of the data persistence on, the Watcher and Responder should at least keep track of the last known block. The current apporach was making this harder.
2020-02-10 16:19:22 +01:00
Sergi Delgado Segura
6c957b067d
Adds batch update unit tests for DBManager
2020-01-31 13:57:30 +01:00
Sergi Delgado Segura
4f000298fa
Removes zmq_subscriber
...
The ZMQSubscriber was merged into the ChainMonitor but never deleted
2020-01-31 13:11:59 +01:00
Sergi Delgado Segura
c538ebadd0
Updates Clear unit tests to use dicts for completed_trackers instead of tuples
2020-01-31 13:10:06 +01:00
Sergi Delgado Segura
451311b765
Updates ChainMonitor unit tests to ititialize the db_manager
...
The Responder needs a DBManager instance to pull the last know block, so None is not valid anymore for this tests
2020-01-31 13:08:55 +01:00
Sergi Delgado Segura
1f88f70c9a
Updates test_carrier with issued_receipts
...
The functionality expected in the test required the issued_receipts dict to be cleare, what is normally performed by the Responder
2020-01-31 13:05:49 +01:00
Sergi Delgado Segura
1a7464f31a
Changes db_manager fixture from session to module
2020-01-31 13:04:23 +01:00
Sergi Delgado Segura
32ff13a495
Fixes loading data from disk when both Watcher and Responder need to be brough up to date
...
The previous approach was not correct, since both actors need to be brought up to date at the same time.
2020-01-31 13:02:32 +01:00
Sergi Delgado Segura
02bc88ed84
Updates Watcher to use db batch updates and avoid multiple decryptions of the same data
2020-01-31 13:00:55 +01:00
Sergi Delgado Segura
a8f2407df9
Updates tests for Responder.check_completed_trackers
2020-01-31 13:00:04 +01:00
Sergi Delgado Segura
d9ce265c00
Updates Responder to minimize data replication operations and properly load data from db
...
- Uses an instance of the Carrier so it can benefit from issued_receipts and avoid resending multiple copies of the same triggered appointment
- Defines last_known_block to properly load data from db
- Uses task_done from Queue to properly signal task completion when boostraping from db
- Creates a checked_txs dict in get_completed_trackers to avoid querying bitcoind for the same transaction over and over
- Redefines completed_trackers as dict instead of tuple
2020-01-31 12:55:21 +01:00
Sergi Delgado Segura
4848b9a058
Updates cleaner to use db batch updates
2020-01-31 12:53:38 +01:00
Sergi Delgado Segura
5bf8dbd9de
Improves load_watcher_appointments and adds methods for batch updating the db
...
Dumping data into the db became a bottleneck mainly due to not using batch aggregation when dealing with huge amounts of info.
2020-01-31 12:52:12 +01:00
Sergi Delgado Segura
0c4b8eaf4a
Adds a dict of sent receipts to act as a cache and avoid sending the same data more than once
...
The dict is supposed to be reset periodically so it does not grow unbounded
2020-01-31 12:48:11 +01:00
Sergi Delgado Segura
b31e24f655
Adds unit tests for Builder.update_states
2020-01-31 12:46:12 +01:00
Sergi Delgado Segura
caab7a8cdd
Adds a method to update the states of the Watcher and Responder if both have missed blocks
...
The Watcher and Responder were not properly bootstrapped from db data if both were missing blocks to process. Since some appointments may need to pass from the Watcher to the Responder during this process, they need to be brought up to date at the same time, block after block.
2020-01-31 12:46:04 +01:00
Sergi Delgado Segura
084295b889
Adds test for triggering appointment with pissad offline
2020-01-24 14:33:04 +01:00
Sergi Delgado Segura
5d068f5ecc
Adds first test of dealing with pisa with a reboot in the middle
2020-01-24 13:40:08 +01:00
Sergi Delgado Segura
d29568e2d7
Merge pull request #87 from sr-gi/fix-build-from-database
...
Fix build from database
2020-01-24 13:36:13 +01:00
Sergi Delgado Segura
a718a5c6ae
Updates Builder unit tests
2020-01-24 13:32:20 +01:00
Sergi Delgado Segura
89181e6a7e
Fixes handling data from db
...
Data obtained from the database was not properly handled in some cases:
- If some appointments are accepted and no block is received and the tower is restarted, the data was not loaded. The tower was checking that the Watcher/Responder had a last known block, which may not have been the case. Now best_tip is set as last_known_block on a fresh bootstrap.
- The Watcher/ Responder were not being awaken when loading data from the database.
- The block queues were not properly populated
2020-01-24 13:31:57 +01:00
Sergi Delgado Segura
7c4d4d0aad
Moves awaking / sleeping functionality to their own methods
2020-01-24 13:24:12 +01:00
Sergi Delgado Segura
ba5aa9f651
Updates builder with new minimal in-memory data from #83
...
- The builder was never modified when the in-memory data was reduced, so it was still trying to build data based on the past approach.
- Renames create_block_queue to poplate_block_queue and repurposes the method
When creating a block queue, a new Queue was created and populated. That was breaking the link between the Watcher/Responder and the ChainMonitor since the Queue is defined beforehand.
2020-01-24 13:21:36 +01:00
Sergi Delgado Segura
26d61ca784
Merge pull request #86 from sr-gi/improve_config
...
Improves config and init files
2020-01-23 21:18:24 +01:00
Sergi Delgado Segura
deb182edda
Updates circle-ci to store keys in data folder
2020-01-23 21:09:39 +01:00
Sergi Delgado Segura
a84d753c4a
Updates generate_key to accept output directory. It stores the keys in the current dir by default.
2020-01-23 20:56:42 +01:00
Sergi Delgado Segura
ebea93c103
Updates circle-ci to create cli conf for unit test
2020-01-23 20:16:39 +01:00
Sergi Delgado Segura
3d13cfbe39
Removes pisad from the commands to be run by circle-ci before e2e tests
2020-01-23 20:16:39 +01:00
Sergi Delgado Segura
3fd84a8d7f
Modifies e2e tests so pisad can be run and stop from there
2020-01-23 20:16:39 +01:00
Sergi Delgado Segura
14724ceda9
Adds missing common/tools unit tests and removes pisad tests
...
`test_pisad.py` was only covering config parsing tests, that are now part of `common/tools.py`.
2020-01-23 20:16:32 +01:00
Sergi Delgado Segura
5c75b1f40d
Removes Logger dependency from setup_data_folder
...
Logger was only used to log when a new folder was created, and was making that the setup needed to be done on the main of pisad and cli instead of __init__, which seems a better fit
2020-01-23 20:12:21 +01:00
Sergi Delgado Segura
dce7b4d39e
Adds missing tools docs
2020-01-23 19:00:55 +01:00
Sergi Delgado Segura
96ab0039e7
Updates config file params for testing
2020-01-23 18:36:18 +01:00
Sergi Delgado Segura
9be2c2475f
Removes logger instance from test_appointment
2020-01-23 18:35:32 +01:00
Sergi Delgado Segura
3185ae124d
Fixes paths on cli tests
2020-01-23 18:34:53 +01:00