private-attribution / ipa

A raw implementation of Interoperable Private Attribution
MIT License
41 stars 23 forks source link

Add `validate_record` API to upgraded contexts #1218

Closed akoshelev closed 1 month ago

akoshelev commented 1 month ago

This API serves multiple purposes:

We could never make the existing API work and kept discovering bugs associated with it.

Previously, the validation process was separate, detached from actual protocol and validated everything at once. We saw multiple occurrences where reveal was called before sharings were validated.

Previous approach did not integrate smoothly with vectorization

Vectorization makes data processed in chunks. Going between different chunk sizes (one for data, one for validation) has proven to be challenging. The code written for that was hard to read.

Validate record API

The core of this proposal is to put validate_record API on the UpgradedContext that takes a record_id and blocks the execution until this record (and others in the same batch) has been validated. FWIW this is exactly how ZKP validator works now.

This API allows to bring closer together MAC and ZKP validation.

In addition to bringing this API, this change also updates all the uses of MAC validators and contexts to use it.

The pros include:

Downsides:

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 94.72141% with 18 lines in your changes missing coverage. Please review.

Project coverage is 92.77%. Comparing base (468e1e3) to head (322e377). Report is 15 commits behind head on main.

Files Patch % Lines
ipa-core/src/protocol/context/batcher.rs 86.11% 10 Missing :warning:
ipa-core/src/protocol/context/malicious.rs 93.65% 4 Missing :warning:
ipa-core/src/protocol/context/semi_honest.rs 0.00% 3 Missing :warning:
ipa-core/src/protocol/context/validator.rs 99.05% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1218 +/- ## ========================================== + Coverage 92.69% 92.77% +0.08% ========================================== Files 196 198 +2 Lines 30503 30781 +278 ========================================== + Hits 28274 28558 +284 + Misses 2229 2223 -6 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.