Commit Graph

92 Commits

Author SHA1 Message Date
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
Sergi Delgado Segura
f0150ce585 Removes hash/cipher configuration and changes AESGCM128 for CHACHA20POLY1305
Updates tests accordingly
2019-12-04 17:46:07 +01:00
Sergi Delgado Segura
c679d59451 Merge branch '59-uncovered-tests' 2019-12-04 14:41:24 +01:00
Turtle
98b3dcae7b Test that server validates signature properly 2019-11-28 09:04:43 -05:00
Sergi Delgado Segura
d2b7216a96 Addresses requested changes 2019-11-22 14:48:38 +00:00
Sergi Delgado Segura
2183c57f53 Updates handle_reorgs and deletes check_tx_in_chain
Updates handle_reorg to work with the current version of the Responder (the old code was outdated and broken).

`check_tx_in_chain` was only used by `handle_reorgs`, and made not much sense at this point. The method need to check if the transaction is in mempool or blockchain, so it seems to make more sense bulding on top of `get_transaction`.
2019-11-20 15:41:50 +00:00
Sergi Delgado Segura
3dad5b7c71 Adds tests for check_tx_in_chain 2019-11-20 13:01:56 +00:00
Sergi Delgado Segura
287dfeeee3 Adds missing test on BlockProessor 2019-11-18 16:39:50 +00:00
Sergi Delgado Segura
764e513ab9 Replaces asserts for Exceptions in simulator 2019-11-18 16:39:23 +00:00
Sergi Delgado Segura
a1c0eeadbc Add missing EncryptedBlob tests 2019-11-18 15:25:15 +00:00
Sergi Delgado Segura
6ff580ed8f Updates test_api according to 1b78060 and add missing cases 2019-11-14 17:38:26 +00:00
Sergi Delgado Segura
f33d2d61ac Moves start api to test_api since it was the only place where it's used 2019-11-14 17:38:19 +00:00
Sergi Delgado Segura
1d1efc9ccf Adds some missing Responder unit tests
Excluding the basic reorgs hangle, we need a better bitcoind mock or a different testing approach to reach a higher code coverage. This is as far as it can get for the Responder at the moment
2019-11-14 15:05:45 +00:00
Sergi Delgado Segura
ca3f6ee1b1 Fixes memory leak bug regarding test db 2019-11-14 15:04:55 +00:00
Sergi Delgado Segura
fb7dfd4df8 Add missing Cleaner unit tests 2019-11-11 13:28:24 +00:00
Sergi Delgado Segura
a1a1206e0c Adds new Watcher unit tests 2019-11-08 18:25:14 +00:00
Sergi Delgado Segura
61a36048de Removes redundant tests 2019-11-08 18:24:33 +00:00
Sergi Delgado Segura
e65b02c473 Adds Cryptographer unit tests 2019-11-08 18:20:25 +00:00
Sergi Delgado Segura
f4f77fb39a Improves test appointment and add missing tests 2019-11-07 19:16:39 +00:00
Sergi Delgado Segura
c384bc78c2 Changes code to use bitcoin_cli from pisa/tools 2019-11-07 19:16:18 +00:00
Sergi Delgado Segura
eb0417858e Adds missing test for EncryptedBlob 2019-11-07 19:16:18 +00:00
Sergi Delgado Segura
82f9de1717 Adds missing Watcher test 2019-11-07 16:56:31 +00:00
Sergi Delgado Segura
8f7505c17a Improves generate_dummy_appointment 2019-11-07 16:56:15 +00:00
Sergi Delgado Segura
20f296c9d4 Reformats code to match code guidelines 2019-11-07 15:47:35 +00:00
Sergi Delgado Segura
8174ec61af Generalizes get_dummy_appointment (there were multiple instances of it in different tests)
Also refactors some unused imports and modifies the watcher tests to use .serialize instead of to_json
2019-11-07 15:08:06 +00:00
Sergi Delgado Segura
99bda73eff Applies fixes after PR review 2019-11-07 15:07:58 +00:00
Sergi Delgado Segura
810f6ec525 Adds methods to store the locator map in the db
In order to use the db for system monitoring we need a way of mapping the locator the the uuids the appointments/jobs are identified in the db. First steps towards #15
2019-11-06 17:08:05 +00:00
Sergi Delgado Segura
6cb6aecc8c Uses dummy functions from conftest and extends with Appointment.triggered flag 2019-11-05 19:13:47 +00:00
Sergi Delgado Segura
a6b1f96aaf Adds dummy appointment and job methods to conftest and includes triggered param to test_api 2019-11-05 19:11:58 +00:00
Sergi Delgado Segura
fc1b8aa13c Adds Builder unit test 2019-11-02 21:17:50 -07:00
Sergi Delgado Segura
65bead3ef7 Uses bitcoin-cli instead of the api for getblockcount 2019-11-02 21:17:35 -07:00
Sergi Delgado Segura
8ad3ae5f1d Initializes block_queue on init
Building from backed up data may require initializing the block queues of both the watcher and responder with the blocks they've missed.
2019-10-30 12:20:42 -07:00
Sergi Delgado Segura
62a68c99cb Fixes #53 2019-10-29 15:20:23 -07:00
Sergi Delgado Segura
a385fa16a9 Adds DBManager unit tests 2019-10-29 14:51:59 -07:00
Sergi Delgado Segura
dfaec51a3b Updates tests to dissable logging based on 17e6066 2019-10-28 14:49:52 -07:00
Sergi Delgado Segura
f61474216c Fixes and tests updates
Updates tests so they run with the db_manager and fixes some bugs introduced in d7d42c9.
2019-10-28 14:49:40 -07:00
Salvatore Ingala
f0143efd14 Move test_sign_appointment after test_add_appointment, as per PR review 2019-10-28 11:11:39 +07:00
Salvatore Ingala
df9a1173a5 Minor refactoring of test_watcher; revert change DEFAULT_PISA_API_SERVER to correct value 2019-10-25 15:03:57 +08:00
Salvatore Ingala
bb090897b4 Test that signature is None if appointment is not added 2019-10-24 12:23:56 +08:00
Salvatore Ingala
a19bfa13ff Separated signing logic of the Watcher in sign_appointment function; added unit test 2019-10-24 12:19:33 +08:00
Salvatore Ingala
e80206c2cd Merge branch 'master' into 13-appointment-signature 2019-10-23 20:51:11 +08:00
Sergi Delgado Segura
52f52f57f8 Apply requested changes
- Adds a PRG based on a hardcoded seed to make the tests reproducible (get_random_value_hex)
- Updates all the tests replacing urandom for get_random_value_hex
- Properly places misplaced bitcoin_cli in bitcoin_sim_tests
- Typos
2019-10-23 12:40:25 +01:00
Salvatore Ingala
cd2f3610f9 Merge branch 'testing' into 13-appointment-signature 2019-10-23 09:19:44 +08:00