From f5f22e7913a3d27d1fdb40166725e5e018b15119 Mon Sep 17 00:00:00 2001 From: Arvid Lunnemark Date: Wed, 29 Jun 2022 10:45:13 -0700 Subject: [PATCH] Friends implementation (#23) * change to system message * it builds * initial tests passing!!! --- Cargo.Bazel.lock | 69 +++++++++++++++++++++++++++++++- asphr_load5.bzl | 5 ++- pir/fast_pir/fast_pir_config.hpp | 4 +- schema/message.proto | 18 +++++---- 4 files changed, 84 insertions(+), 12 deletions(-) diff --git a/Cargo.Bazel.lock b/Cargo.Bazel.lock index b35012a..56bc162 100644 --- a/Cargo.Bazel.lock +++ b/Cargo.Bazel.lock @@ -1,6 +1,69 @@ { - "checksum": "2baaade5e42cd2759e106e809dfbc207c4fdc3010e67328bbf58f77486c07117", + "checksum": "198f0babe8a72f4971fb0af0214760f35eaca9f7c77fd452d5e608ee242ceeb3", "crates": { + "anyhow 1.0.58": { + "name": "anyhow", + "version": "1.0.58", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/anyhow/1.0.58/download", + "sha256": "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" + } + }, + "targets": [ + { + "Library": { + "crate_name": "anyhow", + "crate_root": "src/lib.rs", + "srcs": { + "include": [ + "**/*.rs" + ], + "exclude": [] + } + } + }, + { + "BuildScript": { + "crate_name": "build_script_build", + "crate_root": "build.rs", + "srcs": { + "include": [ + "**/*.rs" + ], + "exclude": [] + } + } + } + ], + "library_target_name": "anyhow", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": [ + "default", + "std" + ], + "deps": { + "common": [ + { + "id": "anyhow 1.0.58", + "target": "build_script_build" + } + ], + "selects": {} + }, + "edition": "2018", + "version": "1.0.58" + }, + "build_script_attrs": { + "data_glob": [ + "**" + ] + }, + "license": "MIT OR Apache-2.0" + }, "cc 1.0.73": { "name": "cc", "version": "1.0.73", @@ -282,6 +345,10 @@ ], "deps": { "common": [ + { + "id": "anyhow 1.0.58", + "target": "anyhow" + }, { "id": "diesel 2.0.0-rc.0", "target": "diesel" diff --git a/asphr_load5.bzl b/asphr_load5.bzl index ccf91e7..cb05198 100644 --- a/asphr_load5.bzl +++ b/asphr_load5.bzl @@ -31,6 +31,9 @@ def load_asphr_repos5(asphr_path): version = "0.24.2", features = ["bundled"], ), + "anyhow": crate.spec( + version = "1.0", + ), }, # Setting the default package name to `""` forces the use of the macros defined in this repository # to always use the root package when looking for dependencies or aliases. This should be considered @@ -39,7 +42,7 @@ def load_asphr_repos5(asphr_path): default_package_name = "", ), ) - + rust_cxx_vendor( name = "third-party", cargo_version = RUST_VERSION, diff --git a/pir/fast_pir/fast_pir_config.hpp b/pir/fast_pir/fast_pir_config.hpp index 2bda414..83ae9af 100644 --- a/pir/fast_pir/fast_pir_config.hpp +++ b/pir/fast_pir/fast_pir_config.hpp @@ -63,7 +63,7 @@ static auto create_context_params() -> seal::EncryptionParameters { return params; } -constexpr size_t SEAL_DB_COLUMNS = CEIL_DIV(MESSAGE_SIZE_BITS, PLAIN_BITS); +constexpr int SEAL_DB_COLUMNS = CEIL_DIV(MESSAGE_SIZE_BITS, PLAIN_BITS); // CLIENT_DB_ROWS is the number of rows that the client thinks is in the // database. this must be an upper bound on the actual database size. note that @@ -77,4 +77,4 @@ constexpr size_t SEAL_DB_COLUMNS = CEIL_DIV(MESSAGE_SIZE_BITS, PLAIN_BITS); // is to be under the GRPC message size limit of 4 MB — to increase this, use // GRPC streaming instead. See // https://jbrandhorst.com/post/grpc-binary-blob-stream/. -constexpr size_t CLIENT_DB_ROWS = 360'000; \ No newline at end of file +constexpr int CLIENT_DB_ROWS = 360'000; \ No newline at end of file diff --git a/schema/message.proto b/schema/message.proto index 7fb999c..d108a09 100644 --- a/schema/message.proto +++ b/schema/message.proto @@ -13,6 +13,11 @@ syntax = "proto3"; package asphrclient; +// keep this in sync with db.rs, SystemMessage +enum SystemMessage { + OUTGOING_INVITATION = 0; +} + // Given that we have a very very limited bandwidth, our goal is to define a Message type that is as small // as possible. // @@ -38,13 +43,10 @@ message Message { // this field is not set if the message isn't long. uint32 chunks_start_sequence_number = 4; - // control messages below. none of the fields below will be set for actual messages. + // system messages below. none of the fields below will be set for actual messages. // - // true iff this message is a control message - bool control = 5; - // keep this in sync with db.rs, ControlMessage constants - enum ControlMessage { - OUTGOING_FRIEND_REQUEST = 0; - } - ControlMessage control_message = 6; + // true iff this message is a system message + bool system = 5; + SystemMessage system_message = 6; + string system_message_data = 7; // optional data for the system message } \ No newline at end of file