-
Notifications
You must be signed in to change notification settings - Fork 28
Conversation
Codecov Report
@@ Coverage Diff @@
## master #497 +/- ##
==========================================
+ Coverage 55.61% 56.05% +0.43%
==========================================
Files 67 67
Lines 3231 3206 -25
==========================================
Hits 1797 1797
+ Misses 1434 1409 -25
Continue to review full report at Codecov.
|
5dcf3d2
to
18e2c0b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good to me. I think it's a bit weird to pass this proxy
around as an argument but I don't see a better solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some concerns about storing the client state on the mobile devices though. Mobile devices offer large attack surfaces and (in my opinion) cannot be trusted. I'm not sure what the threats are exactly but we should evaluate the consequences of this data being accessed or manipulated. The PET protocol mentions "honest but curious" participants, and contains assertions about the participants behaving honestly in some places, but I'm not we can make such assertions if we store sensitive data on the phones.
3c52059
to
8f75130
Compare
8f75130
to
c78a3f3
Compare
Why do we need to de/serialize the client state?
In a mobile environment, we have no control over how long an app (and its data) stays in memory. The operating system can, for example, decide to terminate our app to reduce battery consumption. However, we are dependent on the client not losing its state and being restarted every time. The reason for this can be seen in the diagram above. Let us imagine that the client does not keep its state but is restarted every time. This circumstance is not a problem for the update client, but for the sum client. If we have a long running update phase, the state of the sum client must be kept in ram of the phone until the coordinator has moved into the sum2 phase. However, if the sum client was restarted before reaching the sum2 phase, the sum client cannot complete the task of the sum2 phase. The reason for this lies in the ephemeral secret keys that are regenerated every round as soon as a client transforms into a sum client. For this reason there must be the possibility that the state of the client can be de/serialized and, for example, re/stored from/on a local database/disk.
What changed:
ClientState
struct and only de/serialize theParticipant<_>
struct and theround_params
. However this didn't work out that well because serde doesn't store any type information about the struct.One solution is to wrap it in an enum (you can see the solution in the first commit). However, I didn't want to create another enum just for the de/serialization. So my solution was to move the
Proxy
and thelocal
/global
model out of theClientState
and use theClientStateMachine
enum to de/serialize the participant state and the round parameters.moved the
get_global_model
method out of theClientState
because this function does not depend on the client state.added a
LocalModel
trait to abstract the implementaion how theClientState
gets the local modeladded an experimental incomplete desktop client. I wanted to test how the
LocalModel
trait would work in an async desktop client. I will remove it before merging.removed the runtime field in the
MobileClient
struct. I don't think that it makes sense in the mobile client to keep the tokio runtime in memory. The app will probably not stay open so long that the runtime will be used a second time. So we only spawn one whenever we need one.Future improvments
PhaseName
in the state machinemore ideas in the code comments