Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small problem on updated ahead when using print_ln #1029

Closed
winnnnnny opened this issue May 16, 2023 · 2 comments
Closed

Small problem on updated ahead when using print_ln #1029

winnnnnny opened this issue May 16, 2023 · 2 comments

Comments

@winnnnnny
Copy link

Sorry for disturbing you.
I observed a small problem that the value of the variable would be updated ahead of the update function when the value is printed.
Here is an example.

a = sint(5)
b = sint(10)
# An update in the following line is necessary for triggering strange behavior
a.update(sint(6))
var1 = sint(0)
var2 = sint(97)
# An update in the following line is necessary for triggering strange behavior
var2.update(sint(17))
# var1 should still be 0, but the value is updated in advance from the "var1.update(b)".
print_ln('var1: %s', var1.reveal())
# An update using var1 in the following line is necessary for triggering strange behavior. 
var2.update(var1 + var1)
# var2 shows the correct value
print_ln('var2: %s', var2.reveal())
# som meaningless code
var3 = sint(0)
var4 = sint(1)
# var1 should be updated there
var1.update(b)
# var1 should be printed out to trigger the strange behavior
print_ln('var1: %s', var1.reveal())

The result is shown below.

./Scripts/mascot.sh test
Running /home/mp-spdz/Scripts/../mascot-party.x 0 test -pn 10468 -h localhost -N 2
Running /home/mp-spdz/Scripts/../mascot-party.x 1 test -pn 10468 -h localhost -N 2
Using security parameter 40
var1: 10
var2: 0
var1: 10
The following benchmarks are including preprocessing (offline phase).
Time = 0.00163745 seconds 
Data sent = 0.041528 MB in ~45 rounds (party 0 only; use '-v' for more details)
Global data sent = 0.083056 MB (all parties)

The problem only affects the printed value. The other calculation can be conducted successfully. May you make the print function works more correctly?

@mkskeller
Copy link
Member

Thank you for raising this. You should find that 7f88a8b fixes it.

@winnnnnny
Copy link
Author

Thank you for repairing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants