Commit Graph

596 Commits

Author SHA1 Message Date
Sergi Delgado Segura
a718a5c6ae Updates Builder unit tests 2020-01-24 13:32:20 +01:00
Sergi Delgado Segura
89181e6a7e Fixes handling data from db
Data obtained from the database was not properly handled in some cases:

- If some appointments are accepted and no block is received and the tower is restarted, the data was not loaded. The tower was checking that the Watcher/Responder had a last known block, which may not have been the case. Now best_tip is set as last_known_block on a fresh bootstrap.
- The Watcher/ Responder were not being awaken when loading data from the database.
- The block queues were not properly populated
2020-01-24 13:31:57 +01:00
Sergi Delgado Segura
7c4d4d0aad Moves awaking / sleeping functionality to their own methods 2020-01-24 13:24:12 +01:00
Sergi Delgado Segura
ba5aa9f651 Updates builder with new minimal in-memory data from #83
- The builder was never modified when the in-memory data was reduced, so it was still trying to build data based on the past approach.
- Renames create_block_queue to poplate_block_queue and repurposes the method

When creating a block queue, a new Queue was created and populated. That was breaking the link between the Watcher/Responder and the ChainMonitor since the Queue is defined beforehand.
2020-01-24 13:21:36 +01:00
Sergi Delgado Segura
26d61ca784 Merge pull request #86 from sr-gi/improve_config
Improves config and init files
2020-01-23 21:18:24 +01:00
Sergi Delgado Segura
deb182edda Updates circle-ci to store keys in data folder 2020-01-23 21:09:39 +01:00
Sergi Delgado Segura
a84d753c4a Updates generate_key to accept output directory. It stores the keys in the current dir by default. 2020-01-23 20:56:42 +01:00
Sergi Delgado Segura
ebea93c103 Updates circle-ci to create cli conf for unit test 2020-01-23 20:16:39 +01:00
Sergi Delgado Segura
3d13cfbe39 Removes pisad from the commands to be run by circle-ci before e2e tests 2020-01-23 20:16:39 +01:00
Sergi Delgado Segura
3fd84a8d7f Modifies e2e tests so pisad can be run and stop from there 2020-01-23 20:16:39 +01:00
Sergi Delgado Segura
14724ceda9 Adds missing common/tools unit tests and removes pisad tests
`test_pisad.py` was only covering config parsing tests, that are now part of `common/tools.py`.
2020-01-23 20:16:32 +01:00
Sergi Delgado Segura
5c75b1f40d Removes Logger dependency from setup_data_folder
Logger was only used to log when a new folder was created, and was making that the setup needed to be done on the main of pisad and cli instead of __init__, which seems a better fit
2020-01-23 20:12:21 +01:00
Sergi Delgado Segura
dce7b4d39e Adds missing tools docs 2020-01-23 19:00:55 +01:00
Sergi Delgado Segura
96ab0039e7 Updates config file params for testing 2020-01-23 18:36:18 +01:00
Sergi Delgado Segura
9be2c2475f Removes logger instance from test_appointment 2020-01-23 18:35:32 +01:00
Sergi Delgado Segura
3185ae124d Fixes paths on cli tests 2020-01-23 18:34:53 +01:00
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