Commit Graph

248 Commits

Author SHA1 Message Date
Sergi Delgado Segura
15a66751b2 Additional bug-fixing 2019-10-28 14:49:53 -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
Sergi Delgado Segura
ee1f024c51 Basic restore from backed up data
Tests need to be updated to match with some of the new component design
2019-10-28 14:44:31 -07:00
Sergi Delgado Segura
43b749f417 Create the Builder
The Builder's puerpose is to build data structures from the data obtained from the DB for both the Watcher and the Responder
2019-10-28 14:40:44 -07:00
Sergi Delgado Segura
cf61e6e265 Reports the block hash to the responder on adding response
The responder can use the block hash to figure out whether or not he is on sync
2019-10-28 14:40:44 -07:00
Sergi Delgado Segura
5bf96a10c5 Adds method to compute distance from given block to chain tip 2019-10-28 14:40:44 -07:00
Sergi Delgado Segura
162de92026 Adds class method to create from dict and on_sync method 2019-10-28 14:40:42 -07:00
Sergi Delgado Segura
db87fab9ee Fixes prefix encoding 2019-10-28 14:38:56 -07:00
Sergi Delgado Segura
594cc6ca22 Fixes logging actor 2019-10-28 14:38:56 -07:00
Sergi Delgado Segura
10dc67973e Sets a basic way of dealing with #48
Splits the logging in two loggers (console and file) so the logs can be formatted separately.

A more complete console logging is required though. Right now it only should the message, but it would be nice to include also the parametters in a human-redable and friendly way.

Fixing it using a single Logger will also be nice, but not worth spending too much on.
2019-10-28 14:38:56 -07:00
Sergi Delgado Segura
a0538739d2 Starts data persistence integration
The difference between master and the old data-persistence branch was huge, seems more effective to manually cherry pick the changes and integrate them
2019-10-28 14:38:50 -07:00
Salvatore Ingala
21b54f048e Refactored error handling in add_appointment; minor comments from PR review 2019-10-25 14:51:15 +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
78a0fb46b0 Catching and logging when start_api raises an exception 2019-10-24 11:46:13 +08:00
Salvatore Ingala
b633c89724 Several fixes from PR review 2019-10-23 22:33:34 +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
Sergi Delgado Segura
af0e9c81b5 Adds some missing tests 2019-10-22 16:38:28 +01:00
Sergi Delgado Segura
be16d8af73 Improves responder.
Several changes have been performed:

- Retry counter has been removed (#23)
- Rebroadcast return receipts now
- Re-calling send_transaction if a fixable error occurs should be handled in the responder now (missing)
- Fixes some small bugs
2019-10-22 15:03:18 +01:00
Sergi Delgado Segura
45552e390c Changes send_transaction to not be recursive
send_transaction had an edge case that was treated recursively. Return a receipt instead and handle that in the caller
2019-10-22 15:01:50 +01:00
Salvatore Ingala
9b1af92fc3 Minor fixes 2019-10-22 18:59:27 +08:00
Salvatore Ingala
cbcff453b1 Remove unused import 2019-10-22 14:37:28 +08:00
Salvatore Ingala
8b46c2f496 Merge branch 'testing' into 13-appointment-signature 2019-10-22 12:14:02 +08:00
Salvatore Ingala
1601f0ca15 Renamed constants and default file names for Pisa's private and public keys 2019-10-22 12:13:12 +08:00
Sergi Delgado Segura
3afcf9e708 Flags methods not covered by unit tests 2019-10-21 19:53:34 +01:00
Sergi Delgado Segura
71ce7c46ec Removes the parameters for do_subscribe + PEP8 2019-10-21 16:54:48 +01:00
Sergi Delgado Segura
e5013d5bca Dissables Flask logging 2019-10-21 16:53:29 +01:00
Salvatore Ingala
e71c014535 Sorting keys and removing whitespaces in Appointment.to_json 2019-10-21 11:07:58 +08:00
Salvatore Ingala
8b7597b909 typo 2019-10-18 15:59:23 +08:00
Salvatore Ingala
ca64b59277 Added signature verification to pisa_cli 2019-10-18 14:56:59 +08:00
Salvatore Ingala
414a4638bd Added signature verification to watcher's add_appointment test 2019-10-18 12:37:06 +08:00
Salvatore Ingala
50d53e0960 Converted response format of add_appointment to json 2019-10-18 10:22:04 +08:00
Salvatore Ingala
f4bfd5ef40 Merge branch 'testing' into 13-appointment-signature 2019-10-18 08:32:38 +08:00
Sergi Delgado Segura
c09becd7fa Fixes to_dict/to_json for and some fixes 2019-10-17 19:11:32 +01:00
Sergi Delgado Segura
95759793ba Fixes bitcoin_cli
bitcoin_cli as a global variable in the main __init__.py was creating issues related to http.client.CannotSendRequest: Request-sent and connection re-usage. Define a new connection per request.
2019-10-17 17:17:52 +01:00
Salvatore Ingala
db522500c3 Switched to cryptography instead of ecdsa for signatures 2019-10-17 17:02:09 +08:00
Salvatore Ingala
edd04c23ea non-zero exit code on error 2019-10-17 12:10:38 +08:00
Salvatore Ingala
f19c499efa Handling errors when constructing the Watcher in pisa daemon 2019-10-17 12:08:01 +08:00
Salvatore Ingala
deaf704bc5 Removed redundant parentheses 2019-10-17 09:59:36 +08:00
Salvatore Ingala
41453bd271 Updated sample_conf 2019-10-17 09:59:35 +08:00
Salvatore Ingala
c6db6eddb3 Using a PEM keyfile instead of a DER for the signing key 2019-10-17 09:59:34 +08:00
Salvatore Ingala
7c1d8b69c7 Changed to_json to to_dict in Appointment and Job; added to_json to Appointment to actually return a string 2019-10-17 09:59:34 +08:00
Salvatore Ingala
e4e83167b7 Made signing key optional (will only sign if given) 2019-10-17 09:59:34 +08:00
Salvatore Ingala
99db9a29ad Added signatures to appointment 2019-10-17 09:59:29 +08:00
Sergi Delgado Segura
d7c89ddc91 Modifies behaviour towards a failed EncryptedBlob decrpytion
The decryption for the `EncryptedBlob` using AES-GCM-128 (the only cipher available atm) raises an `InvalidTag` exception. This was not properly captured by the watcher making it crash. This behavior was already discovered during the `EncryptedBlob` unit testing and left to be fixed in the `Watcher` unit testing.

However, making the EncryptedBlob raise such an exception may not be a good practice, since other ciphers may run into different exceptions. Therefore, the `EncryptedBlob` has been modified to return None upon facing a decryption issue, the `BlockProcessor` will detect that and return a None justice_txm and justice_txid. Upon receiving a None `justice_txid` the `Watcher` will delete the appointment without notifiying the `Responder`.
2019-10-14 16:57:46 +01:00
Sergi Delgado Segura
d35b9c13c4 Fixes responder missing_confirmation dict access 2019-10-14 13:00:49 +01:00
Sergi Delgado Segura
6baa059431 Adds additional unit tests to tools 2019-10-11 20:54:31 +01:00
Sergi Delgado Segura
98c27f6013 Adds basic unit tests for the Carrier
Further testing is required for this one.
2019-10-11 19:51:50 +01:00
Sergi Delgado Segura
a916c67cc5 Fixes error logging 2019-10-11 19:32:44 +01:00