Commit Graph

480 Commits

Author SHA1 Message Date
Sergi Delgado Segura
836048c54d Same as 00a989e1b2 but for the cli 2020-01-23 18:31:47 +01:00
Sergi Delgado Segura
00a989e1b2 Updates pisad and __init__ to put together the log and config fixes
The setup of the logs and the parsing of the config file are closely related. The former need info from the later to be created, and needs to be setup only once
per pisa instance. In the same way, the later need to only be loaded and validated once per pisa intance and contains info to setup the logs.

Intead of setting up the logs in init and loading the config file in pisad, now both are dealt with in __init__
2020-01-23 18:27:04 +01:00
Sergi Delgado Segura
0fe5969346 Merge pull request #85 from sr-gi/improve_logging
Fixes logging issues
2020-01-23 18:23:44 +01:00
Sergi Delgado Segura
6884db9f58 Updates logger codebase-wise to match the Logger updates
Logger instances now specify the logger prefix so the logger can be properly loaded, fixing the issues with the cli file logger
2020-01-23 18:16:25 +01:00
Sergi Delgado Segura
1f46e6eb26 Moves logging setup to common
The setup it's identical for cli and pisad
2020-01-23 18:14:34 +01:00
Sergi Delgado Segura
fddf2e6968 Fixes logger not properly working for cli
The Logger was set to use c_logger and f_logger from pisad, so the cli file logs were never created
2020-01-23 18:13:30 +01:00
Sergi Delgado Segura
a3f2d20499 Moves/adds methods to deal with config to common 2020-01-23 18:05:44 +01:00
Sergi Delgado Segura
c1ad1a4924 Updates cli to run with config file 2020-01-23 16:30:09 +01:00
Sergi Delgado Segura
418b7b49ab Creates main function and updates config to add data folder
pisad can now be run easier from other files (simplifies e2e testing)
2020-01-23 16:27:18 +01:00
Sergi Delgado Segura
245d5b49f3 Updates config files
Removes unused values from pisa config file and adds cli config file
2020-01-23 16:23:07 +01:00
Sergi Delgado Segura
852368a2ad Adds tests for sending two different appointments with the same locator to the tower 2020-01-22 16:25:52 +01:00
Sergi Delgado Segura
03f0a270d8 Modifies when the flag is cleared
Now the only time a triggered flag has to be cleared is when a tracker is removed, otherwise the flag is never created.
2020-01-22 16:24:32 +01:00
Sergi Delgado Segura
272e61922d Move triggered flag clearing to the Watcher when a triggered appointment cannot make it to the mempool
When an appointment was triggered a flag was set in the Watcher, and removed later on in the Responder if the transaction ended up being rejected. That's pretty annoying. Since we have information about whether a transaction has made it to the mempool or not via the Carrier's receipt, this can be all done in the Watcher, which makes more sense and reduces the interaction with the db (1 write if succeeds, 0 otherwise instead of 1 write if succeeds, 2 otherwise).
2020-01-22 16:20:08 +01:00
Sergi Delgado Segura
fd6c85ced2 Moves logs to be consistent with the rest of db logs. Adds missing docs and adds an exception if the db is alredy being used 2020-01-22 15:21:55 +01:00
Sergi Delgado Segura
1027f48611 Splits create_txs in two simpler functions and refactors fixtures so setup_node is not called every test 2020-01-22 14:46:59 +01:00
Sergi Delgado Segura
93cb003360 Setup seed for cli and common unit tests to random values are replicable 2020-01-22 11:12:01 +01:00
Sergi Delgado Segura
14503dcebd Adds e2e tests encrypted blobs with wrong key 2020-01-21 19:12:01 +01:00
Sergi Delgado Segura
0f45e8fe11 Adds methods to get seeded random values and fixes create_txs 2020-01-21 19:11:50 +01:00
Sergi Delgado Segura
7bf65c40f5 Updates unit tests, adds tests to cover new methods and removes unused imports 2020-01-21 19:11:33 +01:00
Sergi Delgado Segura
74a9dad071 Updates Watcher to use new Cleaner functions and reformats filter_valid_breaches to return a list of valid and invalid breaches. 2020-01-21 19:11:15 +01:00
Sergi Delgado Segura
33f2ab35d8 Updates responder to use new Cleaner functions 2020-01-21 19:11:02 +01:00
Sergi Delgado Segura
a95e301713 Renames some DBManager methods and adds new functionality
- Refactors store_update_locator_map name to create_append_locator_map, which is a better fit.
- Adds update_locator_map method to update maps by removing some uuids (store_update_locator_map was not covering this, what was misleading).
- Adds missing docs.
2020-01-21 19:09:39 +01:00
Sergi Delgado Segura
5ead43163c Refactors Cleaner to improve its modularity and fixes some small bugs
- Improves code modularity.
- Separates flag_triggered from delete_appointment, which was pretty misleading (and causing some minor bugs) and make them work with lists intead of single objects.
- Removes unused import
2020-01-21 19:06:51 +01:00
Sergi Delgado Segura
2559d143aa Fixes logging 2020-01-21 19:06:29 +01:00
Sergi Delgado Segura
200304cbce Remove unnecessary tailing dots from some log messages 2020-01-21 12:14:51 +01:00
Sergi Delgado Segura
3605590fa4 Updates cli unit tests to match the net post_data_to_add_appointment_endpoint method 2020-01-21 12:07:44 +01:00
Sergi Delgado Segura
568418a18e Simplifies pisa_cli.post_data_to_add_appointment_endpoint
The appointment endpoint was a parameter even though the method is only used to send data the a single endpoint. The json data is only used inside the method, so it can be computed there too.
2020-01-21 12:07:05 +01:00
Sergi Delgado Segura
d7e91d34e7 Updates cli test to expect an exception instead of False 2020-01-20 17:21:56 +01:00
Sergi Delgado Segura
ff4e7f2b67 Adds pisa setup and e2e test run to circle-ci 2020-01-20 17:21:50 +01:00
Sergi Delgado Segura
18cd2a7499 Adds pisa conf for e2e testing and initial setup for the regtest node 2020-01-20 17:02:38 +01:00
Sergi Delgado Segura
396c56e5db Adds name parameter to generate_keys so the name can be chosen from terminal 2020-01-20 17:02:25 +01:00
Sergi Delgado Segura
4eb55eaacc Raises exception on missing cli keys
load_key_file_data was returning False on FileNotFound but get_pk was expecting an exception
2020-01-20 16:19:45 +01:00
Sergi Delgado Segura
892e25e971 ocd fixes 2020-01-20 15:14:04 +01:00
Sergi Delgado Segura
a3423a01e7 Updates Dockerfile to not build ln
We cannot use docker caching with the current circleci plan, so we'll build a lighter image for now
2020-01-20 15:08:08 +01:00
Sergi Delgado Segura
ed31be8a03 Updates circle-ci to cache bitcoin_sandbox requirements 2020-01-20 13:37:41 +01:00
Sergi Delgado Segura
77d678a4ca Updates paths for bitcoin_sandbox 2020-01-20 13:37:09 +01:00
Sergi Delgado Segura
5286cbf0ac Clears circle-ci caches 2020-01-20 12:43:45 +01:00
Sergi Delgado Segura
b38ad70352 Changes circle-ci base image to Ubuntu 2020-01-20 12:38:43 +01:00
Sergi Delgado Segura
2c8c8c7323 Updates circle-ci with basic e2e infraestructure 2020-01-20 11:53:13 +01:00
Sergi Delgado Segura
f91475c61b Updates life cycle tests and adds malformed tx tests 2020-01-17 17:51:09 +01:00
Sergi Delgado Segura
404952415d Creates conftest for e2e tests 2020-01-17 17:51:01 +01:00
Sergi Delgado Segura
0f887feb4d Deletes appointment from Watcher's db if a tracker cannot be added
There was a bug in the Responder where, if a tracker could not be added (e.g. malformed tx) the data was dropped but never removed from the Watcher's db. This is due to flagging appointments as triggered instead of deleting them from the Watcher's db straight away (in order to deal with reorgs in the future).

If that approach is not followed, and appointments are removed from the Watcher's db once they are passed to the Responder, this should be removed since it would be redundant.
2020-01-17 17:47:45 +01:00
Sergi Delgado Segura
dad70eb780 Moves update_delete_locator_map functionality to its own method. 2020-01-17 17:47:05 +01:00
Sergi Delgado Segura
07c9b7d19e Updates error message for RPC_VERIFY_REJECTED rpc error. 2020-01-17 17:46:14 +01:00
Sergi Delgado Segura
b32a867283 Moves db_manager instantiation before checking the connection with bitcoin
As it was until now, if the connection with bitcoind failed, the  command would have also failed, since the db_manager was not yet defined.
2020-01-17 15:32:30 +01:00
Sergi Delgado Segura
15b31105e1 Adds basic E2E testing 2020-01-16 17:09:26 +01:00
Sergi Delgado Segura
db330ce353 Updates cli unit tests to match the bug fixes 2020-01-16 17:09:13 +01:00
Sergi Delgado Segura
90e1245a84 Fixes some bugs based on E2E testing 2020-01-16 17:08:44 +01:00
Sergi Delgado Segura
d3846c1fe6 Merge pull request #84 from sr-gi/update-bitcoind-mock
Update bitcoind mock and circle-cli
2020-01-15 16:45:21 +01:00
Sergi Delgado Segura
5e4e773984 Adds cli requirements to circle-ci 2020-01-15 16:42:07 +01:00