Closed MarcT0K closed 12 months ago
The intended usage of this function is to write things like a = mpc.np_update(a, (0, 1), 42)
. (We would rather write a[0, 1] = 42
but that is hard to implement as an MPyC coroutine.) In any case, the intended effect is that a
is updated in-place. The returned array by mpc.np_update(a, (0, 1), 42)
differs on the outside, but the finite fields array inside is updated in-place.
The integral
attribute does not need to be modified as you currently do, as it is set for the returned array by the call to returnType()
.
Regarding the cases for value
. That can be assumed to have an integral
attribute for now, but that will not always be the case. (Later integer or float, or even a Numpy array with such numbers can be allowed.) Some cases for mismatching value
s are caught because the finite fields do not match, but let's not go to much into this, because this is also true for lots of other functions.
Patch coverage: 100.00%
and no project coverage change.
Comparison is base (
32a6db0
) 93.04% compared to head (ad94bc2
) 93.05%.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I updated the PR based on your feedback:
c3 = np_update(c2, key, value)
) to highlight the behaviour. I also added a sentence in the function docstring so a user could know about the expected use.Is the PR all good now?
I've just rebased the branch to solve the merge conflicts
OK for now, handling the basic case that value has the integral attribute.
This PR aims to fix the behaviour of np_update on
SecureFixedPointArray
. As discussed in #67 , theintegral
property was "lost" during the function.We may need to iterate on the current PR to agree on several points:
integral
property in both the output and input arrays. Is it ok?np_update
? For example, there is no check to prevent aSecureFixedPointArray
to be updated with a secure integer. However, such an update would failed for other reasons. Similarly, can we use a cleartext float (or integer) to update secure arrays? If so, there might be a bug because I obtained some unexpected values.