data61 / MP-SPDZ

Versatile framework for multi-party computation
Other
869 stars 272 forks source link

Issue with writing shares, reading them, and then performing computations on those shares. #513

Closed karannewatia closed 2 years ago

karannewatia commented 2 years ago

Hi,

I'm getting an error when writing shares in an MPC, then reading those shares and performing computations on those shares in a different MPC.

Here's an example:

First MPC code:

n = 2
a = Array(n,sint)
a[0] = sint(100)
a[1] = sint(7)
a.write_to_file(0)

Second MPC code:

tmp = Array(2,sint)
tmp.read_from_file(0)
mult = tmp[0] * tmp[1]
print_ln('Result = %s', mult.reveal())

Here's the output of one the players:

Result = 700
-1332914444279179458075277155529840164091 != 0
-1332914444279179458075277155529840164091 != 0
-1332914444279179458075277155529840164091 != 0
-1332914444279179458075277155529840164091 != 0
terminate called after throwing an instance of '-1332914444279179458075277155529840164091 != 0
Offline_Check_Error'
what():  Offline-Check-Error : CheckFor
Aborted                 (core dumped)

So, it seems that even though the correct result is being printed, the second MPC throws an aborted :(core dumped) error for some reason.

I'm using the same number of players for both MPCs, and I also use the same prime modulus for both of them. Do you know if I'm doing something incorrectly in one of the MPCs, or if there is a bug on your end?

Thank you in advance for your help!

mkskeller commented 2 years ago

Can you share what you called on the command line?

karannewatia commented 2 years ago

Here's how I compiled the two scripts, where 'mult' is the name of the second MPC. I ran it similarly for the first one. ./compile.py -P 38639198081814229462160136773013017198593 mult

Here's how I ran them: ./sy-shamir-party.x -N 5 -T 2 -p 0 mult & ./sy-shamir-party.x -N 5 -T 2 -p 1 mult & ./sy-shamir-party.x -N 5 -T 2 -p 2 mult & ./sy-shamir-party.x -N 5 -T 2 -p 3 mult & ./sy-shamir-party.x -N 5 -T 2 -p 4 mult (5 players, threshold of 2)

mkskeller commented 2 years ago

Thank you for providing this information. You should find that b0e7857cbc29dfa12d5339abf114e83f10b9baf9 fixes it.