Commit Graph

246 Commits

Author SHA1 Message Date
Sergi Delgado Segura
db330ce353 Updates cli unit tests to match the bug fixes 2020-01-16 17:09:13 +01:00
Sergi Delgado Segura
fb8c6c80d3 Updates tests to work with new version of bitcoind_mock 2020-01-15 15:43:00 +01:00
Sergi Delgado Segura
a49f86dd88 Merge branch 'master' into 64-data-to-disk 2020-01-15 12:44:29 +01:00
Sergi Delgado Segura
42a957f555 Merge branch 'master' into chainmonitor 2020-01-15 11:38:32 +01:00
Sergi Delgado Segura
6bf2cb5379 Merge branch 'master' into isolate-config 2020-01-15 10:15:48 +01:00
Turtle
bd41c8b862 Add unit tests for remaining cli functions 2020-01-15 03:35:34 -05:00
Turtle
39208e4b14 Test new functions split off in pisa_cli 2020-01-15 03:35:34 -05:00
Turtle
40d7ca1912 Refactor add_appointment cli code 2020-01-15 03:35:31 -05:00
Turtle
e22bd89534 Test load_config functions 2020-01-15 03:10:13 -05:00
Sergi Delgado Segura
ae772bf91b Adds missing tests
Tests that given a block hash and the two monitor threads running, the hash is only notified to the subscribers once (by the first thread that notices it)
2020-01-13 15:48:52 +01:00
Sergi Delgado Segura
1a26d7d6a3 Fixes typos based on @orbitalturtle comments 2020-01-13 15:31:54 +01:00
Turtle
c22bf220f0 Move config options used by inspector to the constructor 2020-01-13 02:23:07 -05:00
Turtle
7aa74d5953 Move config options used by watcher and responder to the constructor 2020-01-13 02:23:02 -05:00
Sergi Delgado Segura
db46444348 Adapts the tests to work with data in db instead of memory 2020-01-09 18:20:00 +01:00
Sergi Delgado Segura
34636ab8e0 Unit tests for the db_manager triggered_flag functions 2020-01-09 18:18:12 +01:00
Sergi Delgado Segura
dfc90cd930 Sets ChainMonitor terminate on shutdown and removes unused imports 2020-01-07 16:31:17 +01:00
Sergi Delgado Segura
40e656dcd3 ChainMonitor unit tests 2020-01-07 16:09:49 +01:00
Sergi Delgado Segura
f10c3c46eb Updates tests to use ChainMonitor as global fixture 2020-01-07 16:08:10 +01:00
Sergi Delgado Segura
e5514cefce Updates old docs/comments regarding zmq 2020-01-06 12:27:02 +01:00
Sergi Delgado Segura
069e15fdba Updates current tests to work with chain_monitor instead of zmq_sub 2020-01-03 13:36:52 +01:00
Sergi Delgado Segura
a5e9f1b874 Removes unused imports 2020-01-02 11:23:34 +01:00
Sergi Delgado Segura
3ff10ea1bf Makes all BLockProcessor methods static 2020-01-02 11:21:01 +01:00
Sergi Delgado Segura
57d5aa4940 Adds missing block processor tests 2019-12-27 11:12:30 +01:00
Sergi Delgado Segura
ea681850a8 Adds some ChainMaester functionallity to the BlockProcessor
The ChainMaester functionallity has been split into the new bitcoind mock and the blockprocessor (there's ChainMaester no more 😢)
2019-12-23 06:45:24 +01:00
Sergi Delgado Segura
2b0945f1ba Updates tests with external bitcoind mock 2019-12-23 06:43:54 +01:00
Sergi Delgado Segura
ef92e2bf6f Removes bitcoind_mock from the codebase
It can be now found at https://github.com/sr-gi/bitcoind_mock/
2019-12-22 10:29:28 +01:00
Sergi Delgado Segura
fffcb39124 Enables stdout for unit tests
By default pytests does not capture stdout, but it can do with -s. It is nice to have the option to verbose the tests if needed
2019-12-17 17:22:40 +01:00
Sergi Delgado Segura
d4e7e999e1 Sets sim verbose to False for unit tests 2019-12-17 17:21:48 +01:00
Sergi Delgado Segura
b82065120c Adds verbose flag to show/hide block generation on stdout 2019-12-17 17:21:21 +01:00
Sergi Delgado Segura
531523c534 Refactors the API to run using dispatch instead of decorate
The API was never made an object since I couldn't find a way or working around the Flask decorators.

By using dispatch we can get around the issues in #14 and will be able to create better mocks for the API
2019-12-17 17:04:57 +01:00
Sergi Delgado Segura
680de0b7ac Update unit tests to use serialize 2019-12-17 16:22:23 +01:00
Sergi Delgado Segura
a69f1ba28b Moves appointment to common and creates serialize
Appointment serialization used to be part of the cryptographer (signature_format) but it makes more sense to be an appointment method. Therefore cli also need Appointment

Also fixes comments based on reviews
2019-12-17 16:21:54 +01:00
Sergi Delgado Segura
74080bf104 Deletes test file 2019-12-16 13:03:17 +01:00
Sergi Delgado Segura
bc72496db9 Dissables missing logs c_logger 2019-12-16 12:50:44 +01:00
Sergi Delgado Segura
b07b6759ed Adds missing cryptographer tests 2019-12-16 12:50:24 +01:00
Sergi Delgado Segura
61663e89d7 Refactors tests folder to separate different modules
Each module has a different folder and they do not share methods now. At some point they should be split in different repos
2019-12-16 11:26:51 +01:00
Sergi Delgado Segura
2f67ecfa6e Changes sk_path to sk_der in Watcher
The Watcher used to receive a secret key file path ion the __init__ to load a secret key for signing. That made testing the Watcher hard, since the file needed to be present. Changing it so the main (pisad) loads the file from disk and passes the data the Watcher on init.
2019-12-16 10:54:13 +01:00
Sergi Delgado Segura
008a71da3a Renames matches to breaches to be consistent with the Responder. Also adds docstrings 2019-12-13 18:13:29 +01:00
Sergi Delgado Segura
d881706eb3 Refactors the codebase to match the new naming from 793d563b8c053136dd5f936b0ef0cd88af215b06 and 3046eae38ee3f34857c96e6b9d43e645f7d2de2d 2019-12-13 18:13:29 +01:00
Sergi Delgado Segura
91ca9e539f Adds Responder docstrings fixes get_txs_to_rebroadcast and renames some methods
get_txs_to_rebroadcast was beinf triggered based on received transactions indstead of stored txs. Fixing that.

Some of the names in the Responder were poorly picked (not descriptibe enough). Tries to fix that.

``Job`` class has been renames to ``TransactionTracker``.

``add_response`` has been renamed to ``handle_breach`` and ``create_job`` to ``add_tracker``.

All the variables that has `job` on it have already been updated.
2019-12-13 18:12:04 +01:00
Sergi Delgado Segura
df5dcbdfe9 Renames dispute_delta to to_self_delay and justice tx to penalty tx
Uses the naming convention followed by LN implementations and BOLTs
2019-12-11 12:45:05 +01:00
Sergi Delgado Segura
2cdd78b8e6 Simplifies the Cleaner and adds docstrings
We were passing some unnecessary parameters to the Cleaner (locator) that could be derived from other data (uuid and appointments). Also standarises the order of the  parameters to match the rest of the methods
2019-12-10 13:31:42 +01:00
Sergi Delgado Segura
add5d262b6 Includes Appointment docstrings and redesigns triggered flag
The triggered flag is only used to interact with the DB but it was kept as an Appointment attribute. Now it is only used when exporting to json, which is used to store data into the db.
2019-12-09 14:36:16 +01:00
Sergi Delgado Segura
dac9f56901 Gets rid of Appointment.serialize()
The method is replaced by signature_foramt in Cryptographer
2019-12-09 13:31:06 +01:00
Sergi Delgado Segura
d39056a0cc Refactors signing/verifiying functionality to be part of the Cryptographer
- All encryption/decryption and signing/verifying calls are performed by the cryptographer now.

- The current signature format is temporal. We should define something not base on json.

- Some Cryptographer tests are still missing.

- The cli tests should be modified to fit this too.
2019-12-07 13:22:39 +01:00
Sergi Delgado Segura
a8800ac375 Integrates encryption/decryption within the Cryptographer. Close #63
Includes unittests. Also reformats test_inspector to avoid using cli functions
2019-12-06 13:23:02 +01:00
Sergi Delgado Segura
5f7cd7e189 Delete old TODOs 2019-12-05 11:34:44 +01:00
Sergi Delgado Segura
b4197aa5bb Replaces hardcoded 16/32 for LOCATOR lengths 2019-12-05 11:26:58 +01:00
Sergi Delgado Segura
bd08b151df Replaces locator with common/constants value 2019-12-05 11:03:36 +01:00
Sergi Delgado Segura
babb746dbd Create common package
Moves cryptographer to common. Also adds constants and defines the leghtn of the locator to avoid hardcoding it in almost every file
2019-12-05 11:02:17 +01:00