Commit Graph

237 Commits

Author SHA1 Message Date
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
7432eb1373 Improves sim with basic fork logic 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
3502422ee5 Merge pull request #51 from sr-gi/13-appointment-signature
Add Pisa's signature to appointments
2019-10-28 12:47:58 +07:00
Salvatore Ingala
75b28e9bce Moved return inside the try branch, following up on PR review 2019-10-28 11:34:00 +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
bc9c513317 Fix import with absolute path instead of local 2019-10-28 11:07:42 +07:00
Sergi Delgado Segura
e1af22ff12 Adds pytest to contributing 2019-10-26 17:48:11 -07:00
Sergi Delgado Segura
3eb4abda3e Adds basic contributing rules
related to #46 and #47
2019-10-26 17:42:03 -07:00
Sergi Delgado Segura
d787b89421 Removes Dockerfile
I'm not sure what this Dockerfile was doing here, but it's not supposed to be here
2019-10-26 16:39:59 -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
21b54f048e Refactored error handling in add_appointment; minor comments from PR review 2019-10-25 14:51:15 +08:00
Salvatore Ingala
b55355e564 pisa-cli saving appointments and signatures to disk on success 2019-10-25 13:50:16 +08:00
Salvatore Ingala
6348d15cea Moved Logger from __init__ into separate file 2019-10-25 10:39:09 +08:00
Salvatore Ingala
edd6eec2a8 Removed global pisa_public_key, only use locally within is_appointment_signature_valid 2019-10-25 09:54:49 +08:00
Salvatore Ingala
8ab01a5eee Added Logger class to pisa-cli to avoid imports from pisa; changed log file name to pisa-cli.log 2019-10-24 14:44:04 +08:00
Salvatore Ingala
e678dfc661 Fix name fields {start,end}_block --> {start_end}_time; forgot to declare access to global variable 2019-10-24 12:53:44 +08:00
Salvatore Ingala
3658f44996 remove whitespace for PEP8 2019-10-24 12:33:55 +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
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
c682066c4d Merge pull request #41 from sr-gi/testing
Unit tests for most of the pisa components
2019-10-23 13:42:01 +01: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
9d9d7b1e5b Adds responder unit tests 2019-10-22 15:14:38 +01:00
Sergi Delgado Segura
7a222d43fe Updates test cleaner and removes retry_counter for responder 2019-10-22 15:09:47 +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
Sergi Delgado Segura
018faa07d1 Fixes change endianness
Porting change_endianness from Python2 to Python3 introduced a bug.
2019-10-22 14:59:09 +01:00
Salvatore Ingala
ca10a73e76 More standardization of key file names 2019-10-22 20:54:25 +08:00
Salvatore Ingala
9b1af92fc3 Minor fixes 2019-10-22 18:59:27 +08:00
Salvatore Ingala
b39f7ef55b Fix appointment serialization 2019-10-22 15:00:44 +08:00
Salvatore Ingala
cbcff453b1 Remove unused import 2019-10-22 14:37:28 +08:00
Salvatore Ingala
3657e0877a Forgot parameter in formatting error 2019-10-22 14:33:04 +08:00
Salvatore Ingala
503cb8ce41 Refactored validation logic; improved error handling; avoid loading the key unnecessarily 2019-10-22 14:29:08 +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
94156a67cc Adds generate_blocks 2019-10-21 18:12:05 +01:00