Commit Graph

803 Commits

Author SHA1 Message Date
Sergi Delgado Segura
94e36ebeda plugin - Adds docstrings 2020-05-05 20:11:04 +02:00
Sergi Delgado Segura
bef8df8d36 plugin - fixes key generation
Key generation was performed using pyca/crpytography but keys were expected to be objects from coincurve. This comes from teos_cli where keys are generated beforehand and stored, and later on loaded from disk. The plugin generates keys and uses them straightaway (at least the first time), so it would fail in that case.
2020-05-05 18:46:37 +02:00
Sergi Delgado Segura
df43d30ca5 Fixes tests 2020-05-05 17:07:22 +02:00
Sergi Delgado Segura
1fae487071 plugin - Fixes log entry 2020-05-05 17:07:02 +02:00
Sergi Delgado Segura
f5c634ed14 plugin - repurpose invalid_appointments and adds misbehaving_proof
invalid_appointments in TowerInfo was used to stored invalid appointment responses from the tower when it was misbehaving (i.e. wrong or missing signature). However, a single item was stored since the tower is abandoned after misbehaving. data reported as invalid by the tower was not backed up.

invalid_appointments now stores the appointment rejected by the tower and reported as invalid.
misbehaving_proof stores the proof of misbehaviour by the tower (single item)
2020-05-05 17:03:31 +02:00
Sergi Delgado Segura
b650ba3c26 plugin - small changes 2020-05-05 15:22:48 +02:00
Sergi Delgado Segura
8704dcf2b9 plugin - defines TowerSummary as object to improve readability of the code 2020-05-05 15:22:44 +02:00
Sergi Delgado Segura
cb4920b566 plugin - Modifies conf when running tests to reduce running time 2020-05-05 15:19:36 +02:00
Sergi Delgado Segura
ae4cea8aa2 plugin - Adds additional tower tests 2020-05-05 15:19:36 +02:00
Sergi Delgado Segura
03eb67f71f plugin - Some fixes and renaming 2020-05-05 15:19:31 +02:00
Sergi Delgado Segura
01a18b3fd7 Finishes basic test 2020-05-04 19:40:54 +02:00
Sergi Delgado Segura
d3cbfc7ac4 string format -> f-function 2020-05-04 19:40:00 +02:00
Sergi Delgado Segura
93029301bf Refactors plugin to have a single point of db data loading
The previous approach was a bit messy with the db access and could have potential race conditions and data inconsistency

Also replaces format for f-functions for readability
2020-05-04 19:37:13 +02:00
Sergi Delgado Segura
cf5455043c plugin - adds some plugin tests, still WIP 2020-04-30 21:53:51 +02:00
Sergi Delgado Segura
43217874b5 Splits add_appointment so it can also be used by the Retrier
- The appointment constructions is left in Watchtower (via on_commit_revocation method)
- The tower interaction is moved to net/http so it can be reused
- Adds missing logic for invalid resposes by the tower (e.g invalid signatures)
2020-04-29 14:14:01 +02:00
Sergi Delgado Segura
7bbfd925f4 Adds invalid appointment to tower_info
Invalid appointments are those which tower signature is invalid
2020-04-29 13:11:44 +02:00
Sergi Delgado Segura
8575bc6209 plugin - redesigns retrier using backoff 2020-04-29 13:10:51 +02:00
Sergi Delgado Segura
390dc3e090 teos - adds log line with tower id 2020-04-29 13:04:02 +02:00
Sergi Delgado Segura
88c19d5a0d teos - moves errors to common so it can be used by clients 2020-04-29 13:03:39 +02:00
Sergi Delgado Segura
9f2c90d12e plugin - adds Retrier and improves get_tower_info and listtowers
- Logs data identified by tower_id instead of endpoint
- Adds Retrier to deal with retries (for connection errors and rejects) and moves sending logic to net/http
- Adds pending appointments to TowerInfo and serves that information via `get_tower_info` and `list_towers`
- Deals with connection errors (but not with rejections yet)
2020-04-27 19:56:35 +02:00
Sergi Delgado Segura
fa0e103d71 pluggin - adds basic retrier (WIP) 2020-04-27 19:56:31 +02:00
Sergi Delgado Segura
780cb5c202 pluggin - adds pending appointments to towers 2020-04-27 19:51:39 +02:00
Sergi Delgado Segura
75ca281cc4 api - updates errors and separates error from message in api errors responses 2020-04-27 19:51:38 +02:00
Sergi Delgado Segura
8918f15b62 gatekeeper - stores user_info in db after adding appointment (it was missing) 2020-04-27 19:51:38 +02:00
Sergi Delgado Segura
c7ec4e6b7c pluggin - Moves send_appointment to net so it can be reused for retries
Also changes logs so towers are identified by id
2020-04-27 19:51:34 +02:00
Sergi Delgado Segura
bc5f09000a plugin - adds tower state to TowerInfo
The state flags whether the tower is reachable or not so the user can be aware of it
2020-04-27 18:23:58 +02:00
Sergi Delgado Segura
7b3bc6e6a8 plugin - adds gettowersinfo command to get all local data about a tower (from db) 2020-04-23 12:54:16 +02:00
Sergi Delgado Segura
fd4241bfe3 plugin - improves listtowers output to resemble listpeers 2020-04-23 12:54:08 +02:00
Sergi Delgado Segura
df3531dd3e plugin - several improvements in the main class
- Moves from *args to required params after 5f33d63cb6
- tower.endpoint -> tower.netaddr
- Adds basic exception handling logic in add_appointemnt
- Stores appointment data in the database (locator: signature) and keeps summary on memory
2020-04-23 12:49:26 +02:00
Sergi Delgado Segura
d86112d86e plugin - endpoint -> netaddr in TowerInfo and adds get_summary 2020-04-23 12:44:25 +02:00
Sergi Delgado Segura
5f33d63cb6 plugin - simplifies argparser after https://github.com/ElementsProject/lightning/pull/3640 2020-04-23 12:43:16 +02:00
Sergi Delgado Segura
7b6d4a0c9c plugin - specifies cryptography library version 2020-04-23 12:40:24 +02:00
Sergi Delgado Segura
a8b9697a38 teosd - handles AppointmentDBM exceptions
AppointmentDBM creation was outside the main try/except, so exception were not properly handled
2020-04-23 12:38:07 +02:00
Sergi Delgado Segura
afdd8ef47e Merge pull request #137 from talaia-labs/42-decouple-start-end-time
Removes start and end time from the appointment data
2020-04-22 15:31:02 +02:00
Sergi Delgado Segura
4c1f95ca77 e2e - updates e2e tests 2020-04-22 14:56:25 +02:00
Sergi Delgado Segura
f810607348 responder - wipes completed/expired data from the gatekeeper 2020-04-22 14:55:43 +02:00
Sergi Delgado Segura
e7141b295e watcher - wipes completed/expired appointments from the Gatekeeper 2020-04-22 14:55:10 +02:00
Sergi Delgado Segura
f66e4785f2 cleaner - adds delete_gatekeeper_appointments
delete_gatekeeper_appointments takes care of deleting data from the Gatekeeper once it has expired / it has been completed
2020-04-22 14:53:58 +02:00
Sergi Delgado Segura
69e9c12258 gatekeeper reformats update_available_slots to add_update_appointment
- add_update_appointment handles the slot count and also keeps a copy of the appointment uuid and slots taken.
- gatekeeper.appointments is turned to a dict uuid:slots so appointment updates can be computed with no further data
- deleting appointment will also allow to update the slot count with no further data from both the Watcher and the Responder
2020-04-22 14:50:13 +02:00
Sergi Delgado Segura
eb6d292d3c extended_appointment - deletes appointment size 2020-04-22 14:48:00 +02:00
Sergi Delgado Segura
5f7a909804 user_pk/client_pk -> user_id and cli/client -> user (when it does not reffer to the software) 2020-04-21 19:05:20 +02:00
Sergi Delgado Segura
0e5a99b778 Fixes potential runtime errors for dictionaries changing size 2020-04-21 13:40:43 +02:00
Sergi Delgado Segura
7e800ade4a Fixes E2E tests 2020-04-20 18:09:08 +02:00
Sergi Delgado Segura
96cb8d4afd Adds user_id to ExtendedAppointment after authentication
The ExtendedAppointment is passed to the Watcher without user_id, since the user is not yet authenticated.

The Watcher has to add the user_id to the ExtendedAppointment after the user is authenticated.
2020-04-20 17:59:57 +02:00
Sergi Delgado Segura
a1b0236c0a Adds new Responder tests 2020-04-20 17:59:56 +02:00
Sergi Delgado Segura
6ef6e68e18 Adds Responder.get_summary. Fixes bug on Responder.get_expired_trackers 2020-04-20 17:59:56 +02:00
Sergi Delgado Segura
797cb9786e Adds new gatekeeper tests 2020-04-20 17:59:47 +02:00
Sergi Delgado Segura
66dce42526 Adds get_summary to extended appointment
The Watcher used to create the summary, but that was not modular enough and introduced issues when testing
2020-04-20 17:58:41 +02:00
Sergi Delgado Segura
2e6095971d Improves docstrings 2020-04-20 17:58:41 +02:00
Sergi Delgado Segura
eea12a695e Improves API returns for 404 and extends tests to cover it 2020-04-20 17:58:40 +02:00