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

Adding the class ReachOnlyLiquidLegionsV2Mill on the Duchy mill. #1155

Merged
merged 21 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,23 @@ cc_library(
],
)

cc_library(
name = "reach_only_liquid_legions_v2_encryption_utility_wrapper",
srcs = [
"reach_only_liquid_legions_v2_encryption_utility_wrapper.cc",
],
hdrs = [
"reach_only_liquid_legions_v2_encryption_utility_wrapper.h",
],
strip_include_prefix = _INCLUDE_PREFIX,
deps = [
":reach_only_liquid_legions_v2_encryption_utility",
"//src/main/proto/wfa/measurement/internal/duchy/protocol:reach_only_liquid_legions_v2_encryption_methods_cc_proto",
"@wfa_common_cpp//src/main/cc/common_cpp/jni:jni_wrap",
"@wfa_common_cpp//src/main/cc/common_cpp/macros",
],
)

cc_library(
name = "noise_parameters_computation",
srcs = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright 2023 The Cross-Media Measurement Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "wfa/measurement/internal/duchy/protocol/liquid_legions_v2/reach_only_liquid_legions_v2_encryption_utility_wrapper.h"

#include <string>

#include "absl/status/statusor.h"
#include "common_cpp/jni/jni_wrap.h"
#include "common_cpp/macros/macros.h"
#include "wfa/measurement/internal/duchy/protocol/liquid_legions_v2/reach_only_liquid_legions_v2_encryption_utility.h"
#include "wfa/measurement/internal/duchy/protocol/reach_only_liquid_legions_v2_encryption_methods.pb.h"

namespace wfa::measurement::internal::duchy::protocol::liquid_legions_v2 {

absl::StatusOr<std::string> CompleteReachOnlyInitializationPhase(
const std::string& serialized_request) {
return JniWrap<CompleteReachOnlyInitializationPhaseRequest,
CompleteReachOnlyInitializationPhaseResponse>(
serialized_request, CompleteReachOnlyInitializationPhase);
}

absl::StatusOr<std::string> CompleteReachOnlySetupPhase(
const std::string& serialized_request) {
return JniWrap<CompleteReachOnlySetupPhaseRequest,
CompleteReachOnlySetupPhaseResponse>(
serialized_request, CompleteReachOnlySetupPhase);
}

absl::StatusOr<std::string> CompleteReachOnlySetupPhaseAtAggregator(
const std::string& serialized_request) {
return JniWrap<CompleteReachOnlySetupPhaseRequest,
CompleteReachOnlySetupPhaseResponse>(
serialized_request, CompleteReachOnlySetupPhaseAtAggregator);
}

absl::StatusOr<std::string> CompleteReachOnlyExecutionPhase(
const std::string& serialized_request) {
return JniWrap<CompleteReachOnlyExecutionPhaseRequest,
CompleteReachOnlyExecutionPhaseResponse>(
serialized_request, CompleteReachOnlyExecutionPhase);
}

absl::StatusOr<std::string> CompleteReachOnlyExecutionPhaseAtAggregator(
const std::string& serialized_request) {
return JniWrap<CompleteReachOnlyExecutionPhaseAtAggregatorRequest,
CompleteReachOnlyExecutionPhaseAtAggregatorResponse>(
serialized_request, CompleteReachOnlyExecutionPhaseAtAggregator);
}

} // namespace wfa::measurement::internal::duchy::protocol::liquid_legions_v2
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2023 The Cross-Media Measurement Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef SRC_MAIN_CC_WFA_MEASUREMENT_INTERNAL_DUCHY_PROTOCOL_LIQUID_LEGIONS_V2_REACH_ONLY_LIQUID_LEGIONS_V2_ENCRYPTION_UTILITY_WRAPPER_H_
#define SRC_MAIN_CC_WFA_MEASUREMENT_INTERNAL_DUCHY_PROTOCOL_LIQUID_LEGIONS_V2_REACH_ONLY_LIQUID_LEGIONS_V2_ENCRYPTION_UTILITY_WRAPPER_H_

#include <string>

#include "absl/status/statusor.h"

// Wrapper methods used to generate the swig/JNI Java classes.
// The only functionality of these methods are converting between proto messages
// and their corresponding serialized strings, and then calling into the
// reach_only_liquid_legions_v2_encryption_utility methods.
namespace wfa::measurement::internal::duchy::protocol::liquid_legions_v2 {

absl::StatusOr<std::string> CompleteReachOnlyInitializationPhase(
const std::string& serialized_request);

absl::StatusOr<std::string> CompleteReachOnlySetupPhase(
const std::string& serialized_request);

absl::StatusOr<std::string> CompleteReachOnlySetupPhaseAtAggregator(
const std::string& serialized_request);

absl::StatusOr<std::string> CompleteReachOnlyExecutionPhase(
const std::string& serialized_request);

absl::StatusOr<std::string> CompleteReachOnlyExecutionPhaseAtAggregator(
const std::string& serialized_request);

} // namespace wfa::measurement::internal::duchy::protocol::liquid_legions_v2

#endif // SRC_MAIN_CC_WFA_MEASUREMENT_INTERNAL_DUCHY_PROTOCOL_LIQUID_LEGIONS_V2_REACH_ONLY_LIQUID_LEGIONS_V2_ENCRYPTION_UTILITY_WRAPPER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ object LiquidLegionsV2Starter {

return parameters {
maximumFrequency = llv2Config.maximumFrequency
liquidLegionsSketch = liquidLegionsSketchParameters {
sketchParameters = liquidLegionsSketchParameters {
decayRate = llv2Config.sketchParams.decayRate
size = llv2Config.sketchParams.maxSize
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,41 @@ kt_jvm_library(
"@wfa_consent_signaling_client//src/main/kotlin/org/wfanet/measurement/consent/client/duchy",
],
)

kt_jvm_library(
name = "reach_only_liquid_legions_v2_mill",
testonly = True, #TODO: delete when InMemoryKeyStore and FakeHybridCipher are not used.
srcs = [
"ReachOnlyLiquidLegionsV2Mill.kt",
],
runtime_deps = ["@wfa_common_jvm//imports/java/io/grpc/netty"],
deps = [
"//imports/java/io/opentelemetry/api",
"//src/main/kotlin/org/wfanet/measurement/api:public_api_version",
"//src/main/kotlin/org/wfanet/measurement/common/identity",
"//src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill:mill_base",
"//src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto:reachonlyliquidlegionsv2encryption",
"//src/main/kotlin/org/wfanet/measurement/duchy/daemon/utils:computation_conversions",
"//src/main/kotlin/org/wfanet/measurement/duchy/daemon/utils:duchy_order",
"//src/main/kotlin/org/wfanet/measurement/duchy/db/computation",
"//src/main/kotlin/org/wfanet/measurement/duchy/service/system/v1alpha:advance_computation_request_headers",
"//src/main/kotlin/org/wfanet/measurement/system/v1alpha:resource_key",
"//src/main/proto/wfa/any_sketch/crypto:sketch_encryption_methods_kt_jvm_proto",
"//src/main/proto/wfa/measurement/internal/duchy:crypto_kt_jvm_proto",
"//src/main/proto/wfa/measurement/internal/duchy:differential_privacy_kt_jvm_proto",
"//src/main/proto/wfa/measurement/internal/duchy/config:protocols_setup_config_kt_jvm_proto",
"//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_sketch_parameter_kt_jvm_proto",
"//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_noise_config_kt_jvm_proto",
"//src/main/proto/wfa/measurement/internal/duchy/protocol:reach_only_liquid_legions_v2_encryption_methods_kt_jvm_proto",
"//src/main/proto/wfa/measurement/internal/duchy/protocol:reach_only_liquid_legions_v2_kt_jvm_proto",
"//src/main/proto/wfa/measurement/system/v1alpha:computation_control_service_kt_jvm_grpc_proto",
"//src/main/proto/wfa/measurement/system/v1alpha:computation_participants_service_kt_jvm_grpc_proto",
"//src/main/swig/protocol/reachonlyliquidlegionsv2:reach_only_liquid_legions_v2_encryption_utility",
"@wfa_common_jvm//imports/java/com/google/protobuf",
"@wfa_common_jvm//imports/java/io/grpc:api",
"@wfa_common_jvm//imports/kotlin/kotlinx/coroutines:core",
"@wfa_common_jvm//src/main/kotlin/org/wfanet/measurement/common",
"@wfa_common_jvm//src/main/kotlin/org/wfanet/measurement/common/throttler",
"@wfa_consent_signaling_client//src/main/kotlin/org/wfanet/measurement/consent/client/duchy",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,8 @@ class LiquidLegionsV2Mill(
flagCountTuples = readAndCombineAllInputBlobs(token, 1)
maximumFrequency = maximumRequestedFrequency
liquidLegionsParameters = liquidLegionsSketchParameters {
decayRate = llv2Parameters.liquidLegionsSketch.decayRate
size = llv2Parameters.liquidLegionsSketch.size
decayRate = llv2Parameters.sketchParameters.decayRate
size = llv2Parameters.sketchParameters.size
}
vidSamplingIntervalWidth = measurementSpec.vidSamplingInterval.width
if (llv2Parameters.noise.hasReachNoiseConfig()) {
Expand Down
Loading