data61 / MP-SPDZ

Versatile framework for multi-party computation
Other
930 stars 279 forks source link

Custom MPC function runs within online Setup but not within an offline setup followed by an online phase (MASCOT-Protocol) #1027

Closed jueren closed 1 year ago

jueren commented 1 year ago

Dear MP-SPDZ maintainers,

first of all - thank you so much for your brilliant contribution to the field of MPC-Frameworks!

So far i was able to implement, compile and run a custom mpc-function in a 3+ player (local) environment with the following protocols (incl. test-data, ssl-setup etc):

I was also able to run the tutorial using mascot-party.x but also using separate preprocessing and online phases:

However i was not able to run the custom function (using Player-Online.x) after doing the mascot-offline.x - Setup for the function successfully (according to my judgement). I was able to start running the function using Player-Online.x and it seems to start executing (at least the print_ln() does show some output) but it seems that the execution immediately stops when the MPC-function requests secret inputs from the players (get_input_from()), triggering the following console-outputs (for each local player):

Setup:

What did i miss here? Thank you for your help!

Another question - but regarding comparison of (s)ints:

Cheers!

mkskeller commented 1 year ago

Thank you for raising this.

jueren commented 1 year ago

Thank you so much for your fast, detailed and helping answer!

Regarding Preprocessing vs Online Phase: Does this mean, that for the offline-phase, the MPC-Function need to have predefined/fixed parameters, rendering the handy dynamic-compilation-feature (see: https://github.com/data61/MP-SPDZ/blob/master/Programs/Source/test_args.mpc) "useless"? Is there any possibility / workaround to use this dynamic compilation feature (or something similar) still for preprocessing?

As far as i have seen, the compilation process nor the actual computation does offer a possiblity to handle dynamic input sizes? For compilation there are compile-time-arguments that can be used, but there seems to be no possibility to add some command-line parameters (that can be used inside the MPC-Function) for running the actual computation (even though the documentation indicates [<runtime-arg>...]-parameters here: https://mp-spdz.readthedocs.io/en/latest/readme.html?highlight=runtime-arg#running-computation). I assume, there must be some theoretical limitations for this to be the reason, but i could not figure it out yet (as opposed to the number of players, that need to be known in advance in order to build the computational domains). Can you please elaborate a little more on this or guide us towards some literature?

Thank you so much!

Cheers!

mkskeller commented 1 year ago

The framework is geared towards fixed lengths because this allows for the best optimization. Dynamic lengths are sometimes possible, but it might lead to suboptimal execution. However, it's inherently not possible to predict the amount of preprocessing required if there is a relevant dynamic length, so the required preprocessing won't work.