Feature/353 secagg setup serverkey
This MR implements server key generation through Fed-BioMed experiment. You can follow the note secagg
notebook in Notebooks directory.
Before running the examples, certificates for MP-SDPZ should be generated and each of them should be registered in every participant (nodes and researhcer).
Please create 3 components node 1, node 2 and researcher
./scripts/fedbiomed_run node config config-n1.ini configuration create
./scripts/fedbiomed_run node config config-n2.ini configuration create
./scripts/fedbiomed_run researcher configuration create
Use certificate-dev-setup
option to register each certificate of participant in every participants' database
./scripts/fedbiomed_run certificate-dev-setup
Please deploy MNIST dataset in each node. Afterwards, you will be able to run examples in secagg
notebook.
Changes in test files
Test cases for different SecaggSetup
and SecaggContext
elements were implemented in the same class through for
loops. Since Servkey
implementations are completed while SecaggBiprimeSetup
and SecaggBiprimeContext
are still the same, running all the tests in for loop was going to be complicated. Therefore, tests for secagg
classes has been separated in this merge request. For example: for secagg
node setup, there is one test class for base abstract class and two tests for the classes that implements the abstraction.
Refactoring and redesigning in existing classes:
- Useing component type option as an argument of
fedbiomed_mpc
scripts to activate correct environ before running protocols. - Using generator/builder classes ->
SecaggSetup
SecaggManager
to build propersecagg
element by given elementEnum
and arguments - Simplifying codes in
task_secagg
and ``task_secagg_deleteby using builder classes
SecaggSetup` and `SecaggManager` - Use properties for private attributes in SecagContext and SecaggSetup (open to discussion)
- Matching abstract method signature for the methods that implements through child classes:
BaseSecaggManager,
SecaggServkeyManager,
SecaggBiprimeManager. And avoid using
kwargs` for DB related actions
In this merge request following issues are not solved in order to keep it simple:
- If a node doesn't have materials for MP-SDPZ (certificates etc.) it does not execute the MPC. However, researcher and other nodes executes the protocols because they do not know the MP-SDPZ state of the faulty node. Therefore, researcher waits unnecessarily until the timeout is reached.
- If node fails due to mismatched Job id, researcher still tries to execute
shamir-protocol
and waits till the timeout exceed. - If a node has already the key-share on the DB but researcher hasn't, researcher component tries to execute
shamir-protocol
to retrieve server key but nodes does not startshamir-protocol
since they already have the key-share for given secagg id. This problem usually occurs if the timeout is enough for executingshamir-protocol
on the node side but not enough to send the reply back to the researcher
These issue can be solved if the nodes acknowledges/approve the secagg
request before executing shamir-request. So researcher will also wait for the nodes' answer the execute shamir protocol. Thanks to this process, MPC protocol will be executed only if it is necessary or the nodes are ready to execute with all the materials needed for MP-SDPZ.
Developer Certificate Of Origin (DCO)*
By opening this merge request, you agree the Developer Certificate of Origin (DCO)
This DCO essentially means that:
- you offer the changes under the same license agreement as the project, and
- you have the right to do that,
- you did not steal somebody else’s work.
License
Project code files should begin with these comment lines to help trace their origin:
# This file is originally part of Fed-BioMed
# SPDX-License-Identifier: Apache-2.0
Code files can be reused from another project with a compatible non-contaminating license.
They shall retain the original license and copyright mentions.
The CREDIT.md
file and credit/
directory shall be completed and updated accordingly.
Guidelines for MR review
General:
- give a glance to DoD
- check coding rules and coding style
- check docstrings (eg run
tests/docstrings/check_docstrings
)
Specific to some cases:
- update all conda envs consistently (
development
andvpn
, Linux and MacOS) - if modified researcher (eg new attributes in classes) check if breakpoint needs update (
breakpoint
/load_breakpoint
inExperiment()
,save_state
/load_state
in aggregators, strategies, secagg, etc.)