Hi, I wanted to let you know that there seems to be an issue with the MPC compiler (on the mpc_aws branch) when using if-then-else.
Here is an example (with a set to 1 in the input file):
int main(__attribute__((private(0))) int a) {
if ((a * 2) >= a) {
return 0;
}
return a;
}
Build command:
export CARGO_MANIFEST_DIR="$PWD"; export RUST_BACKTRACE=1; ./target/release/examples/circ --parties 2 examples/C/mpc/program.c mpc --cost-model "empirical"
Execution command:
/path/to/ABY/build/bin/aby_interpreter -m mpc -f ./scripts/aby_tests/tests/program_c -t ./scripts/aby_tests/test_inputs/program.txt -r 0 & /path/to/ABY/build/bin/aby_interpreter -m mpc -f ./scripts/aby_tests/tests/program_c -t ./scripts/aby_tests/test_inputs/program.txt -r 1
The output seems to be a random number (a different one with every execution).
I tried some things and found that the error disappears in the following cases:
- the guard evaluates to false (e.g.
(a * 2) >= (a * 3))
- the left comparator in the guard does not contain secrets (e.g.
100 >= a)
- we return a constant instead of
a at the end
The error also vanishes if we use a second input for the comparison (a set to 1, b set to 3 in this example):
int main(__attribute__((private(0))) int a, __attribute__((private(1))) int b) {
if ((4 * a) >= b) {
return 0;
}
return a;
}
Thank you for looking into this!
Hi, I wanted to let you know that there seems to be an issue with the MPC compiler (on the
mpc_awsbranch) when using if-then-else.Here is an example (with
aset to1in the input file):Build command:
Execution command:
The output seems to be a random number (a different one with every execution).
I tried some things and found that the error disappears in the following cases:
(a * 2) >= (a * 3))100 >= a)aat the endThe error also vanishes if we use a second input for the comparison (
aset to1,bset to3in this example):Thank you for looking into this!