Commit Graph

299 Commits

Author SHA1 Message Date
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
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
7fadde556a Fixed client side signature checking 2019-10-18 19:16:35 +08:00
Salvatore Ingala
8b7597b909 typo 2019-10-18 15:59:23 +08:00
Salvatore Ingala
a73b14bf13 Fix signature verificatio in pisa-cli 2019-10-18 15:40:57 +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
2881101e36 Fixed missing return value in test 2019-10-18 08:41:44 +08:00
Salvatore Ingala
f4bfd5ef40 Merge branch 'testing' into 13-appointment-signature 2019-10-18 08:32:38 +08:00
Sergi Delgado Segura
d1d9693435 Adds coverage exclusions 2019-10-17 19:27:43 +01: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
6735aac094 Update tests to use bitcoind_sim event-wise
Also clean son unused imports
2019-10-17 19:08:34 +01:00
Sergi Delgado Segura
1643a7b887 Multiple simulator improvements
The simulator has been updated to work with real transaction structures instead of transaction hashes. It now supports:
	- Non-SegWit transaction format
	- Generation of blocks event-wise and time-wise

Some small issues have also been fixed.

With the new approach, the simulator can be used in a broader range of tests. Moreover tests can run faster since they do not have to wait for blocks. Instead, the generation of new blocks can be triggered by the test.
2019-10-17 19:00:15 +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
9a103ad751 Updated generate_key tool to generate both public and private key files 2019-10-17 09:59:35 +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
3e62cb4b70 Parametrize start and end appointment offsets
Also waits an additional  for transactions to be cleaned to be safe
2019-10-16 12:42:50 +01:00
Sergi Delgado Segura
b74df42a2b Runs bitcoin-cli locally 2019-10-14 17:41:09 +01:00
Sergi Delgado Segura
50d892b197 Remove wrong parenthesis 2019-10-14 17:40:49 +01:00
Sergi Delgado Segura
409f8fb5fb Adds Watcher unit tests 2019-10-14 16:58:31 +01:00
Sergi Delgado Segura
5f87705d26 Dissables can_connect_to_bitcoind with a non-running backend
Until a better way of handling the stop of bitcoind the test is dissabled, it created issues with other tests.
2019-10-14 16:57:58 +01: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
d43ab76220 Updates conftest fixtures so they do not autorun
The modules that need to run either bitcoind or the api do now reference to the fixture in the first test that needs it. Since the fixtures are definexd session-wise the rest of the modules will have access to them from that point on.
2019-10-14 13:19:54 +01:00
Sergi Delgado Segura
d35b9c13c4 Fixes responder missing_confirmation dict access 2019-10-14 13:00:49 +01:00
Sergi Delgado Segura
abe359f7d1 Fixes test to work with session fixtures
Test were running fine standalone but failing / having Address reuse issues when running all together. Fixing that.
2019-10-14 13:00:21 +01:00
Sergi Delgado Segura
e5ab943f8c Adds conftest and defines session fixtures 2019-10-14 12:59:22 +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