-
Notifications
You must be signed in to change notification settings - Fork 20
Oblivious swap network #1682
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
Oblivious swap network #1682
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good overall -- nice implementation! I made a few style suggestions to help with readability of the dense MPC code, and raised one point about the interface exposed for batched oblivious swaps. Thanks!
list: &mut [(Aby3VectorRef, Aby3DistanceRef)], | ||
network: &SwapNetwork, | ||
) -> Result<Vec<(Aby3VectorRefShare, Aby3DistanceRef)>> { | ||
let mut encrypted_list = Vec::with_capacity(list.len()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this with_capacity
allocation do anything since encrypted_list
is only updated by assignment later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, it's useless here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the oblivious_swap_batch
and oblivious_swap_batch_plain_ids
function calls (and related primitives in ops.rs
) would it make sense to change the "id" data which tags along to a generic u32
index instead? It may not for instance always refer to a serial id -- if we're doing a min tree over a restricted sublist, it could refer to an index into an underlying Vec
or similar. So for the plain ids it could pass u32
s instead of Aby3VectorRef
, and for the shared version it could pass Share<u32>
instead of Aby3VectorRefShare
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great now, should be good to merge!
225ca71
to
90aa3e4
Compare
* do not run against dev (#1695) * Bump actions/checkout from 4.2.2 to 5.0.0 (#1651) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.2 to 5.0.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v4.2.2...08c6903) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 5.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Krzysztof Szarek <kszarek@users.noreply.github.com> Co-authored-by: Ertugrul Aypek <ertugrul.aypek@toolsforhumanity.com> * Bump tj-actions/changed-files from 46.0.5 to 47.0.0 (#1656) Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 46.0.5 to 47.0.0. - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](tj-actions/changed-files@ed68ef8...24d32ff) --- updated-dependencies: - dependency-name: tj-actions/changed-files dependency-version: 47.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump docker/setup-buildx-action from 3.10.0 to 3.11.1 (#1652) Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 3.10.0 to 3.11.1. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](docker/setup-buildx-action@v3.10.0...e468171) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-version: 3.11.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump docker/build-push-action from 6.15.0 to 6.18.0 (#1650) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.15.0 to 6.18.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](docker/build-push-action@v6.15.0...2634353) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-version: 6.18.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ertugrul Aypek <ertugrul.aypek@toolsforhumanity.com> * Ability to disable anon stats per-batch, from SQS messages (#1696) * enable the ability to disable anon stats per-batch, from SQS messages * basic tests for e2e anon stats disabled * test fix * probabilistic disablement of anon stats in tests * remove unnecessary if statement * enable reauth in e2e test (#1694) e2e: enable reauth * Oblivious swap network (#1682) Add oblivious swap network * clamp counter to actual buffer size (#1703) * clamp counter to actual buffer size * warning log if clamping * improve logging for anon stats disabling --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Carlo Mazzaferro <carlo.mazzaferro@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Krzysztof Szarek <kszarek@users.noreply.github.com> Co-authored-by: Ertugrul Aypek <ertugrul.aypek@toolsforhumanity.com> Co-authored-by: Wojciech Sromek <157375010+wojciechsromek@users.noreply.github.com> Co-authored-by: iliailia <iliailiashenko@gmail.com>
* draft naive-knn * Release memory correctly add checkpoints and safeguards * clippy * fixes * change floats to fractions * dev: deploy main * dev: Increase timeout to 30min to support batch_size=32 * [POP-2929] add graceful shutdown to the networking stack (#1685) * squash * dont try to reconnect if sessions are dropped * add more shutdown handlers * add cancellation token to the connection builder * reduce logs * address code review * omit reconnect failure due to cancellation * return error if message fails to deserialize * u32 instead of usize and stream.take * Merge main -> dev (#1705) * do not run against dev (#1695) * Bump actions/checkout from 4.2.2 to 5.0.0 (#1651) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.2 to 5.0.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v4.2.2...08c6903) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 5.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Krzysztof Szarek <kszarek@users.noreply.github.com> Co-authored-by: Ertugrul Aypek <ertugrul.aypek@toolsforhumanity.com> * Bump tj-actions/changed-files from 46.0.5 to 47.0.0 (#1656) Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 46.0.5 to 47.0.0. - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](tj-actions/changed-files@ed68ef8...24d32ff) --- updated-dependencies: - dependency-name: tj-actions/changed-files dependency-version: 47.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump docker/setup-buildx-action from 3.10.0 to 3.11.1 (#1652) Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 3.10.0 to 3.11.1. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](docker/setup-buildx-action@v3.10.0...e468171) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-version: 3.11.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump docker/build-push-action from 6.15.0 to 6.18.0 (#1650) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.15.0 to 6.18.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](docker/build-push-action@v6.15.0...2634353) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-version: 6.18.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ertugrul Aypek <ertugrul.aypek@toolsforhumanity.com> * Ability to disable anon stats per-batch, from SQS messages (#1696) * enable the ability to disable anon stats per-batch, from SQS messages * basic tests for e2e anon stats disabled * test fix * probabilistic disablement of anon stats in tests * remove unnecessary if statement * enable reauth in e2e test (#1694) e2e: enable reauth * Oblivious swap network (#1682) Add oblivious swap network * clamp counter to actual buffer size (#1703) * clamp counter to actual buffer size * warning log if clamping * improve logging for anon stats disabling --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Carlo Mazzaferro <carlo.mazzaferro@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Krzysztof Szarek <kszarek@users.noreply.github.com> Co-authored-by: Ertugrul Aypek <ertugrul.aypek@toolsforhumanity.com> Co-authored-by: Wojciech Sromek <157375010+wojciechsromek@users.noreply.github.com> Co-authored-by: iliailia <iliailiashenko@gmail.com> * clippy --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Aurel <naure@users.noreply.github.com> Co-authored-by: sdwoodbury <stuart@inversed.tech> Co-authored-by: Carlo Mazzaferro <carlo.mazzaferro@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Krzysztof Szarek <kszarek@users.noreply.github.com> Co-authored-by: Ertugrul Aypek <ertugrul.aypek@toolsforhumanity.com> Co-authored-by: Wojciech Sromek <157375010+wojciechsromek@users.noreply.github.com> Co-authored-by: iliailia <iliailiashenko@gmail.com> Co-authored-by: Bryan Gillespie <bgillesp@users.noreply.github.com>
See POP-2938.
This is an implementation of
apply_swap_network
, where comparison bits remain secret shared. The number of rounds per layer is 11 where 8 belong to the oblivious comparison subroutine and 3 are reserved by the swapping procedure. More details about the communication complexity of this algorithm can be found here.