diff --git a/src/main/cc/wfa/measurement/protocol/liquid_legions_v2/BUILD.bazel b/src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/BUILD.bazel similarity index 88% rename from src/main/cc/wfa/measurement/protocol/liquid_legions_v2/BUILD.bazel rename to src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/BUILD.bazel index 593fe817b..c5cdace95 100644 --- a/src/main/cc/wfa/measurement/protocol/liquid_legions_v2/BUILD.bazel +++ b/src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/BUILD.bazel @@ -24,7 +24,7 @@ cc_library( "//src/main/cc/wfa/measurement/common/crypto:encryption_utility_helper", "//src/main/cc/wfa/measurement/common/crypto:protocol_cryptor", "//src/main/cc/wfa/measurement/common/crypto:started_thread_cpu_timer", - "//src/main/proto/wfa/measurement/protocol/crypto:liquid_legions_v2_encryption_methods_cc_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_encryption_methods_cc_proto", "@any_sketch//src/main/cc/estimation:estimators", "@any_sketch//src/main/cc/math:distributions", "@any_sketch//src/main/cc/math:noise_parameters_computation", @@ -46,7 +46,7 @@ cc_library( ":liquid_legions_v2_encryption_utility", "//src/main/cc/wfa/measurement/common:macros", "//src/main/cc/wfa/measurement/common/crypto:encryption_utility_helper", - "//src/main/proto/wfa/measurement/protocol/crypto:liquid_legions_v2_encryption_methods_cc_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_encryption_methods_cc_proto", "@com_google_private_join_and_compute//util:status_includes", ], ) diff --git a/src/main/cc/wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.cc b/src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.cc similarity index 99% rename from src/main/cc/wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.cc rename to src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.cc index e7e3c99aa..676d6716b 100644 --- a/src/main/cc/wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.cc +++ b/src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.h" +#include "wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.h" #include #include @@ -34,7 +34,7 @@ #include "wfa/measurement/common/macros.h" #include "wfa/measurement/common/string_block_sorter.h" -namespace wfa::measurement::protocol::liquid_legions_v2 { +namespace wfa::measurement::internal::duchy::protocol::liquid_legions_v2 { namespace { @@ -1029,4 +1029,4 @@ CompleteExecutionPhaseThreeAtAggregator( return response; } -} // namespace wfa::measurement::protocol::liquid_legions_v2 +} // namespace wfa::measurement::internal::duchy::protocol::liquid_legions_v2 diff --git a/src/main/cc/wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.h b/src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.h similarity index 70% rename from src/main/cc/wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.h rename to src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.h index 8e8935ec7..4ff6f17a6 100644 --- a/src/main/cc/wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.h +++ b/src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.h @@ -12,32 +12,40 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SRC_MAIN_CC_WFA_MEASUREMENT_PROTOCOL_LIQUID_LEGIONS_V2_LIQUID_LEGIONS_V2_ENCRYPTION_UTILITY_H_ -#define SRC_MAIN_CC_WFA_MEASUREMENT_PROTOCOL_LIQUID_LEGIONS_V2_LIQUID_LEGIONS_V2_ENCRYPTION_UTILITY_H_ +#ifndef SRC_MAIN_CC_WFA_MEASUREMENT_INTERNAL_DUCHY_PROTOCOL_LIQUID_LEGIONS_V2_LIQUID_LEGIONS_V2_ENCRYPTION_UTILITY_H_ +#define SRC_MAIN_CC_WFA_MEASUREMENT_INTERNAL_DUCHY_PROTOCOL_LIQUID_LEGIONS_V2_LIQUID_LEGIONS_V2_ENCRYPTION_UTILITY_H_ #include "absl/status/statusor.h" -#include "wfa/measurement/protocol/crypto/liquid_legions_v2_encryption_methods.pb.h" +#include "wfa/measurement/internal/duchy/protocol/liquid_legions_v2_encryption_methods.pb.h" -namespace wfa::measurement::protocol::liquid_legions_v2 { +namespace wfa::measurement::internal::duchy::protocol::liquid_legions_v2 { -using ::wfa::measurement::protocol:: +using ::wfa::measurement::internal::duchy::protocol:: CompleteExecutionPhaseOneAtAggregatorRequest; -using ::wfa::measurement::protocol:: +using ::wfa::measurement::internal::duchy::protocol:: CompleteExecutionPhaseOneAtAggregatorResponse; -using ::wfa::measurement::protocol::CompleteExecutionPhaseOneRequest; -using ::wfa::measurement::protocol::CompleteExecutionPhaseOneResponse; -using ::wfa::measurement::protocol:: +using ::wfa::measurement::internal::duchy::protocol:: + CompleteExecutionPhaseOneRequest; +using ::wfa::measurement::internal::duchy::protocol:: + CompleteExecutionPhaseOneResponse; +using ::wfa::measurement::internal::duchy::protocol:: CompleteExecutionPhaseThreeAtAggregatorRequest; -using ::wfa::measurement::protocol:: +using ::wfa::measurement::internal::duchy::protocol:: CompleteExecutionPhaseThreeAtAggregatorResponse; -using ::wfa::measurement::protocol::CompleteExecutionPhaseThreeRequest; -using ::wfa::measurement::protocol::CompleteExecutionPhaseThreeResponse; -using ::wfa::measurement::protocol:: +using ::wfa::measurement::internal::duchy::protocol:: + CompleteExecutionPhaseThreeRequest; +using ::wfa::measurement::internal::duchy::protocol:: + CompleteExecutionPhaseThreeResponse; +using ::wfa::measurement::internal::duchy::protocol:: + CompleteExecutionPhaseTwoAtAggregatorRequest; +using ::wfa::measurement::internal::duchy::protocol:: CompleteExecutionPhaseTwoAtAggregatorResponse; -using ::wfa::measurement::protocol::CompleteExecutionPhaseTwoRequest; -using ::wfa::measurement::protocol::CompleteExecutionPhaseTwoResponse; -using ::wfa::measurement::protocol::CompleteSetupPhaseRequest; -using ::wfa::measurement::protocol::CompleteSetupPhaseResponse; +using ::wfa::measurement::internal::duchy::protocol:: + CompleteExecutionPhaseTwoRequest; +using ::wfa::measurement::internal::duchy::protocol:: + CompleteExecutionPhaseTwoResponse; +using ::wfa::measurement::internal::duchy::protocol::CompleteSetupPhaseRequest; +using ::wfa::measurement::internal::duchy::protocol::CompleteSetupPhaseResponse; // Complete work in the setup phase at both the aggregator and non-aggregator // workers. More specifically, the worker would @@ -102,6 +110,6 @@ absl::StatusOr CompleteExecutionPhaseThreeAtAggregator( const CompleteExecutionPhaseThreeAtAggregatorRequest& request); -} // namespace wfa::measurement::protocol::liquid_legions_v2 +} // namespace wfa::measurement::internal::duchy::protocol::liquid_legions_v2 -#endif // SRC_MAIN_CC_WFA_MEASUREMENT_PROTOCOL_LIQUID_LEGIONS_V2_LIQUID_LEGIONS_V2_ENCRYPTION_UTILITY_H_ +#endif // SRC_MAIN_CC_WFA_MEASUREMENT_INTERNAL_DUCHY_PROTOCOL_LIQUID_LEGIONS_V2_LIQUID_LEGIONS_V2_ENCRYPTION_UTILITY_H_ diff --git a/src/main/cc/wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.cc b/src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.cc similarity index 88% rename from src/main/cc/wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.cc rename to src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.cc index e52f8f69c..80bbc4bd1 100644 --- a/src/main/cc/wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.cc +++ b/src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.cc @@ -12,16 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.h" +#include "wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.h" #include "absl/status/statusor.h" #include "util/status_macros.h" #include "wfa/measurement/common/crypto/encryption_utility_helper.h" #include "wfa/measurement/common/macros.h" -#include "wfa/measurement/protocol/crypto/liquid_legions_v2_encryption_methods.pb.h" -#include "wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.h" +#include "wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.h" +#include "wfa/measurement/internal/duchy/protocol/liquid_legions_v2_encryption_methods.pb.h" -namespace wfa::measurement::protocol::liquid_legions_v2 { +namespace wfa::measurement::internal::duchy::protocol::liquid_legions_v2 { using ::wfa::measurement::common::crypto::ParseRequestFromString; @@ -89,4 +89,4 @@ absl::StatusOr CompleteExecutionPhaseThreeAtAggregator( return result.SerializeAsString(); } -} // namespace wfa::measurement::protocol::liquid_legions_v2 +} // namespace wfa::measurement::internal::duchy::protocol::liquid_legions_v2 diff --git a/src/main/cc/wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.h b/src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.h similarity index 75% rename from src/main/cc/wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.h rename to src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.h index 7cc997bf7..3cabfd1ad 100644 --- a/src/main/cc/wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.h +++ b/src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SRC_MAIN_CC_WFA_MEASUREMENT_PROTOCOL_LIQUID_LEGIONS_V2_LIQUID_LEGIONS_V2_ENCRYPTION_UTILITY_WRAPPER_H_ -#define SRC_MAIN_CC_WFA_MEASUREMENT_PROTOCOL_LIQUID_LEGIONS_V2_LIQUID_LEGIONS_V2_ENCRYPTION_UTILITY_WRAPPER_H_ +#ifndef SRC_MAIN_CC_WFA_MEASUREMENT_INTERNAL_DUCHY_PROTOCOL_LIQUID_LEGIONS_V2_LIQUID_LEGIONS_V2_ENCRYPTION_UTILITY_WRAPPER_H_ +#define SRC_MAIN_CC_WFA_MEASUREMENT_INTERNAL_DUCHY_PROTOCOL_LIQUID_LEGIONS_V2_LIQUID_LEGIONS_V2_ENCRYPTION_UTILITY_WRAPPER_H_ #include @@ -23,7 +23,7 @@ // The only functionality of these methods are converting between proto messages // and their corresponding serialized strings, and then calling into the // liquid_legions_v2_encryption_utility methods. -namespace wfa::measurement::protocol::liquid_legions_v2 { +namespace wfa::measurement::internal::duchy::protocol::liquid_legions_v2 { absl::StatusOr CompleteSetupPhase( const std::string& serialized_request); @@ -46,6 +46,6 @@ absl::StatusOr CompleteExecutionPhaseThree( absl::StatusOr CompleteExecutionPhaseThreeAtAggregator( const std::string& serialized_request); -} // namespace wfa::measurement::protocol::liquid_legions_v2 +} // namespace wfa::measurement::internal::duchy::protocol::liquid_legions_v2 -#endif // SRC_MAIN_CC_WFA_MEASUREMENT_PROTOCOL_LIQUID_LEGIONS_V2_LIQUID_LEGIONS_V2_ENCRYPTION_UTILITY_WRAPPER_H_ +#endif // SRC_MAIN_CC_WFA_MEASUREMENT_INTERNAL_DUCHY_PROTOCOL_LIQUID_LEGIONS_V2_LIQUID_LEGIONS_V2_ENCRYPTION_UTILITY_WRAPPER_H_ diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/ComputationStage.kt b/src/main/kotlin/org/wfanet/measurement/duchy/ComputationStage.kt index a9e802c0a..a8777d8fb 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/ComputationStage.kt +++ b/src/main/kotlin/org/wfanet/measurement/duchy/ComputationStage.kt @@ -15,7 +15,7 @@ package org.wfanet.measurement.duchy import org.wfanet.measurement.internal.duchy.ComputationStage -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2 +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2 import org.wfanet.measurement.system.v1alpha.GlobalComputationStatusUpdate.MpcAlgorithm val ComputationStage.name: String diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/herald/BUILD.bazel b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/herald/BUILD.bazel index 11e0e7f32..cf876fa5c 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/herald/BUILD.bazel +++ b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/herald/BUILD.bazel @@ -17,7 +17,7 @@ kt_jvm_library( "//src/main/kotlin/org/wfanet/measurement/duchy/db/computation", "//src/main/proto/wfa/measurement/internal/duchy:computations_service_kt_jvm_grpc", "//src/main/proto/wfa/measurement/internal/duchy/config:protocols_setup_config_java_proto", - "//src/main/proto/wfa/measurement/protocol:requisition_java_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:requisition_java_proto", "//src/main/proto/wfa/measurement/system/v1alpha:global_computation_service_kt_jvm_grpc", ], ) diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/herald/Herald.kt b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/herald/Herald.kt index a635eaa5e..ce2ed5978 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/herald/Herald.kt +++ b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/herald/Herald.kt @@ -31,7 +31,7 @@ import org.wfanet.measurement.duchy.service.internal.computation.toGetTokenReque import org.wfanet.measurement.internal.duchy.ComputationDetails import org.wfanet.measurement.internal.duchy.ComputationsGrpcKt.ComputationsCoroutineStub import org.wfanet.measurement.internal.duchy.config.ProtocolsSetupConfig -import org.wfanet.measurement.protocol.RequisitionKey +import org.wfanet.measurement.internal.duchy.protocol.RequisitionKey import org.wfanet.measurement.system.v1alpha.GlobalComputation import org.wfanet.measurement.system.v1alpha.GlobalComputation.State import org.wfanet.measurement.system.v1alpha.GlobalComputationsGrpcKt.GlobalComputationsCoroutineStub @@ -186,8 +186,8 @@ class Herald( private suspend fun startAttempt(globalId: String) { logger.info("[id=$globalId]: Starting Computation") val token = computationStorageClient.getComputationToken(globalId.toGetTokenRequest()).token - when (token.computationDetails.detailsCase) { - ComputationDetails.DetailsCase.LIQUID_LEGIONS_V2 -> + when (token.computationDetails.protocolCase) { + ComputationDetails.ProtocolCase.LIQUID_LEGIONS_V2 -> LiquidLegionsV2Starter.startComputation( token, computationStorageClient, diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/herald/LiquidLegionsV2Starter.kt b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/herald/LiquidLegionsV2Starter.kt index e31a1b0d0..930bc81b5 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/herald/LiquidLegionsV2Starter.kt +++ b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/herald/LiquidLegionsV2Starter.kt @@ -25,7 +25,7 @@ import org.wfanet.measurement.internal.duchy.ComputationTypeEnum import org.wfanet.measurement.internal.duchy.ComputationsGrpcKt.ComputationsCoroutineStub import org.wfanet.measurement.internal.duchy.CreateComputationRequest import org.wfanet.measurement.internal.duchy.config.ProtocolsSetupConfig -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage import org.wfanet.measurement.system.v1alpha.GlobalComputation object LiquidLegionsV2Starter : ProtocolStarter { @@ -88,10 +88,12 @@ object LiquidLegionsV2Starter : ProtocolStarter { } // For past stages, we throw. - Stage.CONFIRM_REQUISITIONS_PHASE -> { + Stage.INITIALIZATION_PHASE, + Stage.WAIT_REQUISITIONS_AND_KEY_SET, + Stage.CONFIRMATION_PHASE -> { error( "[id=${token.globalComputationId}]: cannot start a computation still" + - " in state CONFIRM_REQUISITIONS_PHASE" + " in state ${stage.name}" ) } diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/BUILD.bazel b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/BUILD.bazel index 3f96839c8..65ce6f6ee 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/BUILD.bazel +++ b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/BUILD.bazel @@ -29,7 +29,7 @@ kt_jvm_library( "//src/main/proto/wfa/measurement/internal/duchy:computation_token_java_proto", "//src/main/proto/wfa/measurement/internal/duchy:metric_value_java_proto", "//src/main/proto/wfa/measurement/internal/duchy:metric_values_service_kt_jvm_grpc", - "//src/main/proto/wfa/measurement/protocol:requisition_java_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:requisition_java_proto", "//src/main/proto/wfa/measurement/system/v1alpha:computation_control_service_kt_jvm_grpc", "//src/main/proto/wfa/measurement/system/v1alpha:global_computation_service_kt_jvm_grpc", ], diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/MillBase.kt b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/MillBase.kt index 2fe1e7b21..6269e58f6 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/MillBase.kt +++ b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/MillBase.kt @@ -60,7 +60,7 @@ import org.wfanet.measurement.internal.duchy.GetMetricValueRequest import org.wfanet.measurement.internal.duchy.MetricValue.ResourceKey import org.wfanet.measurement.internal.duchy.MetricValuesGrpcKt import org.wfanet.measurement.internal.duchy.StreamMetricValueRequest -import org.wfanet.measurement.protocol.RequisitionKey +import org.wfanet.measurement.internal.duchy.protocol.RequisitionKey import org.wfanet.measurement.system.v1alpha.AdvanceComputationRequest import org.wfanet.measurement.system.v1alpha.ComputationControlGrpcKt.ComputationControlCoroutineStub import org.wfanet.measurement.system.v1alpha.CreateGlobalComputationStatusUpdateRequest diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/BUILD.bazel b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/BUILD.bazel index b30083cec..b151077ed 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/BUILD.bazel +++ b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/BUILD.bazel @@ -30,9 +30,9 @@ kt_jvm_library( "//src/main/kotlin/org/wfanet/measurement/duchy/service/system/v1alpha:advance_computation_request_headers", "//src/main/proto/wfa/measurement/internal/duchy:metric_values_service_kt_jvm_grpc", "//src/main/proto/wfa/measurement/internal/duchy/config:protocols_setup_config_java_proto", - "//src/main/proto/wfa/measurement/protocol:liquid_legions_v2_java_proto", - "//src/main/proto/wfa/measurement/protocol/crypto:liquid_legions_v2_encryption_methods_java_proto", - "//src/main/proto/wfa/measurement/protocol/crypto:liquid_legions_v2_noise_config_java_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_encryption_methods_java_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_java_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_noise_config_java_proto", "//src/main/proto/wfa/measurement/system/v1alpha:computation_control_service_kt_jvm_grpc", "//src/main/proto/wfa/measurement/system/v1alpha:global_computation_service_kt_jvm_grpc", "//src/main/swig/protocol/liquidlegionsv2:liquid_legions_v2_encryption_utility", diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/LiquidLegionsV2Mill.kt b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/LiquidLegionsV2Mill.kt index 5bcde231d..0aafef6d6 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/LiquidLegionsV2Mill.kt +++ b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/LiquidLegionsV2Mill.kt @@ -50,23 +50,23 @@ import org.wfanet.measurement.internal.duchy.MetricValuesGrpcKt.MetricValuesCoro import org.wfanet.measurement.internal.duchy.UpdateComputationDetailsRequest import org.wfanet.measurement.internal.duchy.config.LiquidLegionsV2SetupConfig.RoleInComputation.AGGREGATOR import org.wfanet.measurement.internal.duchy.config.LiquidLegionsV2SetupConfig.RoleInComputation.NON_AGGREGATOR -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneAtAggregatorRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneAtAggregatorResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeAtAggregatorRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeAtAggregatorResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoAtAggregatorRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoAtAggregatorResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoResponse -import org.wfanet.measurement.protocol.CompleteSetupPhaseRequest -import org.wfanet.measurement.protocol.CompleteSetupPhaseResponse -import org.wfanet.measurement.protocol.FlagCountTupleNoiseGenerationParameters -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage -import org.wfanet.measurement.protocol.LiquidLegionsV2NoiseConfig +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneAtAggregatorRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneAtAggregatorResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeAtAggregatorRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeAtAggregatorResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoAtAggregatorRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoAtAggregatorResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteSetupPhaseRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteSetupPhaseResponse +import org.wfanet.measurement.internal.duchy.protocol.FlagCountTupleNoiseGenerationParameters +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsV2NoiseConfig import org.wfanet.measurement.system.v1alpha.ComputationControlGrpcKt.ComputationControlCoroutineStub import org.wfanet.measurement.system.v1alpha.ConfirmGlobalComputationRequest import org.wfanet.measurement.system.v1alpha.FinishGlobalComputationRequest @@ -131,8 +131,8 @@ class LiquidLegionsV2Mill( private val actions = mapOf( - Pair(Stage.CONFIRM_REQUISITIONS_PHASE, AGGREGATOR) to ::confirmRequisitions, - Pair(Stage.CONFIRM_REQUISITIONS_PHASE, NON_AGGREGATOR) to ::confirmRequisitions, + Pair(Stage.CONFIRMATION_PHASE, AGGREGATOR) to ::confirmRequisitions, + Pair(Stage.CONFIRMATION_PHASE, NON_AGGREGATOR) to ::confirmRequisitions, Pair(Stage.SETUP_PHASE, AGGREGATOR) to ::completeSetupPhaseAtAggregator, Pair(Stage.SETUP_PHASE, NON_AGGREGATOR) to ::completeSetupPhaseAtNonAggregator, Pair(Stage.EXECUTION_PHASE_ONE, AGGREGATOR) to ::completeExecutionPhaseOneAtAggregator, diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/BUILD.bazel b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/BUILD.bazel index 556b9942d..58d12e445 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/BUILD.bazel +++ b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/BUILD.bazel @@ -8,7 +8,7 @@ kt_jvm_library( deps = [ "//imports/java/com/google/protobuf", "//src/main/kotlin/org/wfanet/measurement/common", - "//src/main/proto/wfa/measurement/protocol/crypto:liquid_legions_v2_encryption_methods_java_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_encryption_methods_java_proto", "//src/main/swig/protocol/liquidlegionsv2:liquid_legions_v2_encryption_utility", ], ) diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/JniLiquidLegionsV2Encryption.kt b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/JniLiquidLegionsV2Encryption.kt index 658cce93e..8fc917ad0 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/JniLiquidLegionsV2Encryption.kt +++ b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/JniLiquidLegionsV2Encryption.kt @@ -16,21 +16,21 @@ package org.wfanet.measurement.duchy.daemon.mill.liquidlegionsv2.crypto import java.nio.file.Paths import org.wfanet.measurement.common.loadLibrary -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneAtAggregatorRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneAtAggregatorResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeAtAggregatorRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeAtAggregatorResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoAtAggregatorRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoAtAggregatorResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoResponse -import org.wfanet.measurement.protocol.CompleteSetupPhaseRequest -import org.wfanet.measurement.protocol.CompleteSetupPhaseResponse -import org.wfanet.measurement.protocol.liquidlegionsv2.LiquidLegionsV2EncryptionUtility +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneAtAggregatorRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneAtAggregatorResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeAtAggregatorRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeAtAggregatorResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoAtAggregatorRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoAtAggregatorResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteSetupPhaseRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteSetupPhaseResponse +import org.wfanet.measurement.internal.duchy.protocol.liquidlegionsv2.LiquidLegionsV2EncryptionUtility /** * A [LiquidLegionsV2Encryption] implementation using the JNI [LiquidLegionsV2EncryptionUtility]. diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/LiquidLegionsV2Encryption.kt b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/LiquidLegionsV2Encryption.kt index f426267ff..8cd535399 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/LiquidLegionsV2Encryption.kt +++ b/src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/LiquidLegionsV2Encryption.kt @@ -14,20 +14,20 @@ package org.wfanet.measurement.duchy.daemon.mill.liquidlegionsv2.crypto -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneAtAggregatorRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneAtAggregatorResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeAtAggregatorRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeAtAggregatorResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoAtAggregatorRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoAtAggregatorResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoResponse -import org.wfanet.measurement.protocol.CompleteSetupPhaseRequest -import org.wfanet.measurement.protocol.CompleteSetupPhaseResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneAtAggregatorRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneAtAggregatorResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeAtAggregatorRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeAtAggregatorResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoAtAggregatorRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoAtAggregatorResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteSetupPhaseRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteSetupPhaseResponse /** * Crypto operations for the Liquid Legions v2 protocol. check diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/db/computation/BUILD.bazel b/src/main/kotlin/org/wfanet/measurement/duchy/db/computation/BUILD.bazel index f785fe112..1ee7a98f3 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/db/computation/BUILD.bazel +++ b/src/main/kotlin/org/wfanet/measurement/duchy/db/computation/BUILD.bazel @@ -16,6 +16,6 @@ kt_jvm_library( "//src/main/proto/wfa/measurement/internal/duchy:computation_details_java_proto", "//src/main/proto/wfa/measurement/internal/duchy:computation_token_java_proto", "//src/main/proto/wfa/measurement/internal/duchy:computations_service_kt_jvm_grpc", - "//src/main/proto/wfa/measurement/protocol:liquid_legions_v2_java_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_java_proto", ], ) diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/db/computation/LiquidLegionsSketchAggregationV2Protocol.kt b/src/main/kotlin/org/wfanet/measurement/duchy/db/computation/LiquidLegionsSketchAggregationV2Protocol.kt index fb02be360..cc64b94f5 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/db/computation/LiquidLegionsSketchAggregationV2Protocol.kt +++ b/src/main/kotlin/org/wfanet/measurement/duchy/db/computation/LiquidLegionsSketchAggregationV2Protocol.kt @@ -20,19 +20,21 @@ import org.wfanet.measurement.internal.duchy.ComputationDetails import org.wfanet.measurement.internal.duchy.ComputationStage import org.wfanet.measurement.internal.duchy.ComputationStageDetails import org.wfanet.measurement.internal.duchy.config.LiquidLegionsV2SetupConfig.RoleInComputation -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2 -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.COMPLETE -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.CONFIRM_REQUISITIONS_PHASE -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.EXECUTION_PHASE_ONE -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.EXECUTION_PHASE_THREE -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.EXECUTION_PHASE_TWO -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.SETUP_PHASE -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.UNRECOGNIZED -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_EXECUTION_PHASE_ONE_INPUTS -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_EXECUTION_PHASE_THREE_INPUTS -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_EXECUTION_PHASE_TWO_INPUTS -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_SETUP_PHASE_INPUTS -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_TO_START +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2 +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.COMPLETE +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.CONFIRMATION_PHASE +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.EXECUTION_PHASE_ONE +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.EXECUTION_PHASE_THREE +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.EXECUTION_PHASE_TWO +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.INITIALIZATION_PHASE +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.SETUP_PHASE +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.UNRECOGNIZED +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_EXECUTION_PHASE_ONE_INPUTS +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_EXECUTION_PHASE_THREE_INPUTS +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_EXECUTION_PHASE_TWO_INPUTS +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_REQUISITIONS_AND_KEY_SET +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_SETUP_PHASE_INPUTS +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_TO_START /** * Helper classes for working with stages of the Liquid Legions Sketch Aggregation V2 MPC defined in @@ -52,12 +54,14 @@ import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.WA object LiquidLegionsSketchAggregationV2Protocol { /** Implementation of [ProtocolStageEnumHelper] for [LiquidLegionsSketchAggregationV2.Stage]. */ object EnumStages : ProtocolStageEnumHelper { - override val validInitialStages = setOf(CONFIRM_REQUISITIONS_PHASE) + override val validInitialStages = setOf(CONFIRMATION_PHASE) override val validTerminalStages = setOf(COMPLETE) override val validSuccessors = mapOf( - CONFIRM_REQUISITIONS_PHASE to setOf(WAIT_TO_START, WAIT_SETUP_PHASE_INPUTS), + INITIALIZATION_PHASE to setOf(WAIT_REQUISITIONS_AND_KEY_SET), + WAIT_REQUISITIONS_AND_KEY_SET to setOf(CONFIRMATION_PHASE), + CONFIRMATION_PHASE to setOf(WAIT_TO_START, WAIT_SETUP_PHASE_INPUTS), WAIT_TO_START to setOf(SETUP_PHASE), WAIT_SETUP_PHASE_INPUTS to setOf(SETUP_PHASE), SETUP_PHASE to setOf(WAIT_EXECUTION_PHASE_ONE_INPUTS), @@ -79,7 +83,7 @@ object LiquidLegionsSketchAggregationV2Protocol { return LiquidLegionsSketchAggregationV2.Stage.forNumber(value.toInt()) ?: UNRECOGNIZED } - /** Translates [LiquidLegionsSketchAggregationV2.Stage]s into [ComputationStageDetails]. */ + /** Translates [LiquidLegionsSketchAggregationV2.Stage] s into [ComputationStageDetails]. */ class Details(val otherDuchies: List) : ProtocolStageDetails< LiquidLegionsSketchAggregationV2.Stage, @@ -102,10 +106,12 @@ object LiquidLegionsSketchAggregationV2Protocol { ): AfterTransition { return when (stage) { // Stages of computation mapping some number of inputs to single output. + CONFIRMATION_PHASE, SETUP_PHASE, EXECUTION_PHASE_ONE, EXECUTION_PHASE_TWO, EXECUTION_PHASE_THREE -> AfterTransition.ADD_UNCLAIMED_TO_QUEUE + WAIT_REQUISITIONS_AND_KEY_SET, WAIT_TO_START, WAIT_SETUP_PHASE_INPUTS, WAIT_EXECUTION_PHASE_ONE_INPUTS, @@ -115,15 +121,13 @@ object LiquidLegionsSketchAggregationV2Protocol { // Stages that we can't transition to ever. UNRECOGNIZED, LiquidLegionsSketchAggregationV2.Stage.STAGE_UNKNOWN, - CONFIRM_REQUISITIONS_PHASE -> error("Cannot make transition function to stage $stage") + INITIALIZATION_PHASE -> error("Cannot make transition function to stage $stage") } } override fun outputBlobNumbersForStage(stage: LiquidLegionsSketchAggregationV2.Stage): Int { return when (stage) { - WAIT_TO_START -> - // There is no output in this stage, the input is forwarded to the next stage as input. - 0 + WAIT_REQUISITIONS_AND_KEY_SET, CONFIRMATION_PHASE, WAIT_TO_START -> 0 WAIT_EXECUTION_PHASE_ONE_INPUTS, WAIT_EXECUTION_PHASE_TWO_INPUTS, WAIT_EXECUTION_PHASE_THREE_INPUTS, @@ -142,7 +146,7 @@ object LiquidLegionsSketchAggregationV2Protocol { // Stages that we can't transition to ever. UNRECOGNIZED, LiquidLegionsSketchAggregationV2.Stage.STAGE_UNKNOWN, - CONFIRM_REQUISITIONS_PHASE -> error("Cannot make transition function to stage $stage") + INITIALIZATION_PHASE -> error("Cannot make transition function to stage $stage") } } @@ -192,7 +196,7 @@ object LiquidLegionsSketchAggregationV2Protocol { EnumStages.longToEnum(value).toProtocolStage() /** - * Translates [LiquidLegionsSketchAggregationV2.Stage]s wrapped in a [ComputationStage] into + * Translates [LiquidLegionsSketchAggregationV2.Stage] s wrapped in a [ComputationStage] into * [ComputationStageDetails]. */ class Details(otherDuchies: List) : diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/deploy/common/daemon/mill/liquidlegionsv2/BUILD.bazel b/src/main/kotlin/org/wfanet/measurement/duchy/deploy/common/daemon/mill/liquidlegionsv2/BUILD.bazel index 85f2fd8dc..f4a69b314 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/deploy/common/daemon/mill/liquidlegionsv2/BUILD.bazel +++ b/src/main/kotlin/org/wfanet/measurement/duchy/deploy/common/daemon/mill/liquidlegionsv2/BUILD.bazel @@ -25,7 +25,7 @@ kt_jvm_library( "//src/main/kotlin/org/wfanet/measurement/duchy/deploy/common:flags", "//src/main/proto/wfa/measurement/internal/duchy:computations_service_kt_jvm_grpc", "//src/main/proto/wfa/measurement/internal/duchy:metric_values_service_kt_jvm_grpc", - "//src/main/proto/wfa/measurement/protocol:liquid_legions_v2_java_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_java_proto", "//src/main/proto/wfa/measurement/system/v1alpha:computation_control_service_kt_jvm_grpc", "//src/main/proto/wfa/measurement/system/v1alpha:global_computation_service_kt_jvm_grpc", ], diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/deploy/common/daemon/mill/liquidlegionsv2/LiquidLegionsV2MillDaemon.kt b/src/main/kotlin/org/wfanet/measurement/duchy/deploy/common/daemon/mill/liquidlegionsv2/LiquidLegionsV2MillDaemon.kt index 8761a510f..0f93e574c 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/deploy/common/daemon/mill/liquidlegionsv2/LiquidLegionsV2MillDaemon.kt +++ b/src/main/kotlin/org/wfanet/measurement/duchy/deploy/common/daemon/mill/liquidlegionsv2/LiquidLegionsV2MillDaemon.kt @@ -32,7 +32,7 @@ import org.wfanet.measurement.duchy.db.computation.ComputationDataClients import org.wfanet.measurement.internal.duchy.ComputationStatsGrpcKt.ComputationStatsCoroutineStub import org.wfanet.measurement.internal.duchy.ComputationsGrpcKt.ComputationsCoroutineStub import org.wfanet.measurement.internal.duchy.MetricValuesGrpcKt.MetricValuesCoroutineStub -import org.wfanet.measurement.protocol.LiquidLegionsV2NoiseConfig +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsV2NoiseConfig import org.wfanet.measurement.storage.StorageClient import org.wfanet.measurement.system.v1alpha.ComputationControlGrpcKt.ComputationControlCoroutineStub import org.wfanet.measurement.system.v1alpha.GlobalComputationsGrpcKt.GlobalComputationsCoroutineStub diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/deploy/gcloud/spanner/computations.sdl b/src/main/kotlin/org/wfanet/measurement/duchy/deploy/gcloud/spanner/computations.sdl index 35dc9e406..aafd11151 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/deploy/gcloud/spanner/computations.sdl +++ b/src/main/kotlin/org/wfanet/measurement/duchy/deploy/gcloud/spanner/computations.sdl @@ -134,6 +134,19 @@ CREATE TABLE Requisitions ( -- A reference to the BLOB. If empty, then the requisition is unfulfilled PathToBlob STRING(MAX), + + -- Serialized bytes of a proto3 protobuf with details about the requisition. + -- The details are obtained from the Kingdom's ComputationsService. + -- + -- See the wfa.measurement.internal.RequisitionDetails Proto + RequisitionDetails BYTES(MAX) NOT NULL, + + -- Canonical JSON string of a proto3 protobuf with details about the + -- requisition. The details are obtained from the Kingdom's + -- ComputationsService. + -- + -- See the wfa.measurement.internal.RequisitionDetails Proto + RequisitionDetailsJSON STRING(MAX) NOT NULL, ) PRIMARY KEY (ComputationId, RequisitionId), INTERLEAVE IN PARENT Computations ON DELETE CASCADE; diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/service/internal/computation/ComputationsService.kt b/src/main/kotlin/org/wfanet/measurement/duchy/service/internal/computation/ComputationsService.kt index bd7fcc184..d173a56ca 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/service/internal/computation/ComputationsService.kt +++ b/src/main/kotlin/org/wfanet/measurement/duchy/service/internal/computation/ComputationsService.kt @@ -148,7 +148,7 @@ class ComputationsService( override suspend fun updateComputationDetails( request: UpdateComputationDetailsRequest ): UpdateComputationDetailsResponse { - require(request.token.computationDetails.detailsCase == request.details.detailsCase) { + require(request.token.computationDetails.protocolCase == request.details.protocolCase) { "The protocol type cannot change." } computationsDatabase.updateComputationDetails( diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/service/internal/computationcontrol/LiquidLegionsSketchAggregationV2Context.kt b/src/main/kotlin/org/wfanet/measurement/duchy/service/internal/computationcontrol/LiquidLegionsSketchAggregationV2Context.kt index 2937b7da6..e134859cf 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/service/internal/computationcontrol/LiquidLegionsSketchAggregationV2Context.kt +++ b/src/main/kotlin/org/wfanet/measurement/duchy/service/internal/computationcontrol/LiquidLegionsSketchAggregationV2Context.kt @@ -24,7 +24,7 @@ import org.wfanet.measurement.internal.duchy.ComputationStage import org.wfanet.measurement.internal.duchy.ComputationStageBlobMetadata import org.wfanet.measurement.internal.duchy.ComputationToken import org.wfanet.measurement.internal.duchy.ComputationTypeEnum.ComputationType.LIQUID_LEGIONS_SKETCH_AGGREGATION_V2 -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage /** * Context for a single [AdvanceComputationRequest] for a LIQUID_LEGIONS_SKETCH_AGGREGATION_V2 diff --git a/src/main/kotlin/org/wfanet/measurement/duchy/service/system/v1alpha/AdvanceComputationRequestHeaders.kt b/src/main/kotlin/org/wfanet/measurement/duchy/service/system/v1alpha/AdvanceComputationRequestHeaders.kt index 7cccb9eaa..9d1924b3f 100644 --- a/src/main/kotlin/org/wfanet/measurement/duchy/service/system/v1alpha/AdvanceComputationRequestHeaders.kt +++ b/src/main/kotlin/org/wfanet/measurement/duchy/service/system/v1alpha/AdvanceComputationRequestHeaders.kt @@ -17,7 +17,7 @@ package org.wfanet.measurement.duchy.service.system.v1alpha import org.wfanet.measurement.common.grpc.failGrpc import org.wfanet.measurement.duchy.toProtocolStage import org.wfanet.measurement.internal.duchy.ComputationStage -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2 +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2 import org.wfanet.measurement.system.v1alpha.AdvanceComputationRequest import org.wfanet.measurement.system.v1alpha.AdvanceComputationRequest.Header.ProtocolCase import org.wfanet.measurement.system.v1alpha.LiquidLegionsV2 diff --git a/src/main/proto/wfa/measurement/internal/duchy/BUILD.bazel b/src/main/proto/wfa/measurement/internal/duchy/BUILD.bazel index c077da4ac..aeb921ee8 100644 --- a/src/main/proto/wfa/measurement/internal/duchy/BUILD.bazel +++ b/src/main/proto/wfa/measurement/internal/duchy/BUILD.bazel @@ -22,7 +22,7 @@ proto_library( srcs = ["computation_protocols.proto"], strip_import_prefix = IMPORT_PREFIX, deps = [ - "//src/main/proto/wfa/measurement/protocol:liquid_legions_v2_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_proto", ], ) @@ -36,7 +36,8 @@ proto_library( srcs = ["computation_details.proto"], strip_import_prefix = IMPORT_PREFIX, deps = [ - "//src/main/proto/wfa/measurement/protocol:liquid_legions_v2_proto", + ":crypto_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_proto", ], ) @@ -69,6 +70,7 @@ proto_library( ":computation_blob_dependency_proto", ":computation_details_proto", ":computation_protocols_proto", + ":requisition_details_proto", ], ) @@ -77,6 +79,17 @@ java_proto_library( deps = [":computation_token_proto"], ) +proto_library( + name = "requisition_details_proto", + srcs = ["requisition_details.proto"], + strip_import_prefix = IMPORT_PREFIX, +) + +java_proto_library( + name = "requisition_details_java_proto", + deps = [":requisition_details_proto"], +) + proto_library( name = "metric_value_proto", srcs = ["metric_value.proto"], @@ -123,3 +136,25 @@ kt_jvm_grpc_and_java_proto_library( name = "async_computation_control_service_kt_jvm_grpc", srcs = [":async_computation_control_service_proto"], ) + +proto_library( + name = "crypto_proto", + srcs = ["crypto.proto"], + strip_import_prefix = IMPORT_PREFIX, +) + +java_proto_library( + name = "crypto_java_proto", + deps = [":crypto_proto"], +) + +proto_library( + name = "differential_privacy_proto", + srcs = ["differential_privacy.proto"], + strip_import_prefix = IMPORT_PREFIX, +) + +java_proto_library( + name = "differential_privacy_java_proto", + deps = [":differential_privacy_proto"], +) diff --git a/src/main/proto/wfa/measurement/internal/duchy/computation_details.proto b/src/main/proto/wfa/measurement/internal/duchy/computation_details.proto index 29544ff8d..9403fc214 100644 --- a/src/main/proto/wfa/measurement/internal/duchy/computation_details.proto +++ b/src/main/proto/wfa/measurement/internal/duchy/computation_details.proto @@ -16,23 +16,17 @@ syntax = "proto3"; package wfa.measurement.internal.duchy; -import "wfa/measurement/protocol/liquid_legions_sketch_aggregation_v2.proto"; +import "wfa/measurement/internal/duchy/crypto.proto"; +import "wfa/measurement/internal/duchy/protocol/liquid_legions_sketch_aggregation_v2.proto"; option java_package = "org.wfanet.measurement.internal.duchy"; option java_multiple_files = true; // Details about a computation at a MPC Worker Node. message ComputationDetails { - // Protocol Specific Details - oneof details { - // Details specific to the liquidLegionV2 protocol. - protocol.LiquidLegionsSketchAggregationV2.ComputationDetails - liquid_legions_v2 = 1; - } - - // A prefix of all the BLOBs stored for this computation. This is used for - // cleaning up after a computation when the BLOBs are no longer needed. - string blobs_storage_prefix = 3; + // A prefix of all the blobs stored for this computation. This is used for + // cleaning up after a computation when the blobs are no longer needed. + string blobs_storage_prefix = 1; enum CompletedReason { UNSPECIFIED = 0; @@ -45,7 +39,38 @@ message ComputationDetails { } // The final state of the computation at this duchy. This is only set // when the protocol has finished for the computation. - CompletedReason ending_state = 4; + CompletedReason ending_state = 2; + + // The Computation obtained from the Kingdom system API. + // This field is written by the herald, and consumed by mills. + message KingdomComputationDetails { + // Serialized `MeasurementSpec` from public API. + // For consent signaling verification only. + bytes measurement_spec = 1; + + // Serialized `DataProviderList` from public API. + // For consent signaling verification only. + bytes data_provider_list = 2; + + // Salt for SHA256 hash of `data_provider_list`. + // For consent signaling verification only. + bytes data_provider_list_salt = 3; + + // Public key for asymmetric encryption. Used when encrypting the final + // result. + EncryptionPublicKey measurement_public_key = 4; + + // HybridCipherSuite used when encrypting the final result. + HybridCipherSuite cipher_suite = 5; + } + KingdomComputationDetails kingdom_computation = 3; + + // Protocol Specific Details + oneof protocol { + // Details specific to the liquidLegionV2 protocol. + protocol.LiquidLegionsSketchAggregationV2.ComputationDetails + liquid_legions_v2 = 4; + } } // Details about a single attempt of a computation stage. diff --git a/src/main/proto/wfa/measurement/internal/duchy/computation_protocols.proto b/src/main/proto/wfa/measurement/internal/duchy/computation_protocols.proto index 180ec7400..8076c4600 100644 --- a/src/main/proto/wfa/measurement/internal/duchy/computation_protocols.proto +++ b/src/main/proto/wfa/measurement/internal/duchy/computation_protocols.proto @@ -16,7 +16,7 @@ syntax = "proto3"; package wfa.measurement.internal.duchy; -import "wfa/measurement/protocol/liquid_legions_sketch_aggregation_v2.proto"; +import "wfa/measurement/internal/duchy/protocol/liquid_legions_sketch_aggregation_v2.proto"; option java_package = "org.wfanet.measurement.internal.duchy"; option java_multiple_files = true; diff --git a/src/main/proto/wfa/measurement/internal/duchy/computation_token.proto b/src/main/proto/wfa/measurement/internal/duchy/computation_token.proto index 131d5d4f9..e2e3f9f55 100644 --- a/src/main/proto/wfa/measurement/internal/duchy/computation_token.proto +++ b/src/main/proto/wfa/measurement/internal/duchy/computation_token.proto @@ -19,6 +19,7 @@ package wfa.measurement.internal.duchy; import "wfa/measurement/internal/duchy/computation_blob_dependency.proto"; import "wfa/measurement/internal/duchy/computation_details.proto"; import "wfa/measurement/internal/duchy/computation_protocols.proto"; +import "wfa/measurement/internal/duchy/requisition_details.proto"; option java_package = "org.wfanet.measurement.internal.duchy"; option java_multiple_files = true; @@ -56,14 +57,17 @@ message ComputationToken { // Details pertinent to the specific stage of a computation. Not // all stages will have details. ComputationStageDetails stage_specific_details = 8; + + // Metadata about requisition used in this computation. + repeated RequisitionMetadata requisitions = 9; } -// Metadata about a BLOb for a particular stage of the computation. +// Metadata about a blob for a particular stage of the computation. message ComputationStageBlobMetadata { // The way in which the stage depends upon the blob. ComputationBlobDependency dependency_type = 1; - // The path to the BLOb if it exists. This is always set for an + // The path to the blob if it exists. This is always set for an // input blob because all inputs must be written before a stage can begin, // but may not be set for an output blob. string path = 2; @@ -71,3 +75,15 @@ message ComputationStageBlobMetadata { // The identifier of the blob. int64 blob_id = 3; } + +// Metadata about a blob for a particular requisition. +message RequisitionMetadata { + // External ID of the data provider. + string external_data_provider_id = 1; + // External ID of the requisition. + string external_requisition_id = 2; + // The path to the blob if fulfilled locally. Otherwise empty. + string path = 3; + // Detail of the requisition. + RequisitionDetails details = 4; +} diff --git a/src/main/proto/wfa/measurement/internal/duchy/crypto.proto b/src/main/proto/wfa/measurement/internal/duchy/crypto.proto new file mode 100644 index 000000000..b68dd6d34 --- /dev/null +++ b/src/main/proto/wfa/measurement/internal/duchy/crypto.proto @@ -0,0 +1,80 @@ +// Copyright 2021 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. + +syntax = "proto3"; + +package wfa.measurement.internal.duchy; + +option java_package = "org.wfanet.measurement.internal.duchy"; +option java_multiple_files = true; + +// Public keys of the ElGamal cipher. +message ElGamalPublicKey { + // Public key generator `g`. + bytes generator = 1; + // Public key element `y = g^x`, where `g` is the generator and `x` is the + // secret key. + bytes element = 2; +} + +// Keys of the ElGamal cipher. +message ElGamalKeyPair { + // Secret key of the ElGamal cipher. + bytes secret_key = 1; + // Public key of the ElGamal cipher. + ElGamalPublicKey public_key = 2; +} + +// A public key for asymmetric encryption. +message EncryptionPublicKey { + enum Type { + TYPE_UNSPECIFIED = 0; + + // Elliptic curve key on the NIST P-256 curve. + // + // Algorithm identifier: + // id-ecPublicKey + // prime256v1 + EC_P256 = 1; + } + // Type of encryption key. Required. + Type type = 1; + + // The ASN.1 SubjectPublicKeyInfo in DER format. Required. + // + // The AlgorithmIdentifier must match `key_type`. + bytes public_key_info = 2; +} + +// Description of a cipher suite for hybrid encryption using the KEM/DEM +// paradigm. +message HybridCipherSuite { + enum KeyEncapsulationMechanism { + KEY_ENCAPSULATION_MECHANISM_UNSPECIFIED = 0; + + // ECDH over NIST P-256 with HKDF using HMAC-SHA256. + ECDH_P256_HKDF_HMAC_SHA256 = 1; + } + // The KEM for this cipher suite. + KeyEncapsulationMechanism kem = 1; + + enum DataEncapsulationMechanism { + DATA_ENCAPSULATION_MECHANISM_UNSPECIFIED = 0; + + // AES-128 with GCM. + AES_128_GCM = 1; + } + // The DEM for this cipher suite. + DataEncapsulationMechanism dem = 2; +} diff --git a/src/main/proto/wfa/measurement/internal/duchy/differential_privacy.proto b/src/main/proto/wfa/measurement/internal/duchy/differential_privacy.proto new file mode 100644 index 000000000..a4315fe97 --- /dev/null +++ b/src/main/proto/wfa/measurement/internal/duchy/differential_privacy.proto @@ -0,0 +1,30 @@ +// Copyright 2021 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. + +syntax = "proto3"; + +package wfa.measurement.internal.duchy; + +option java_package = "org.wfanet.measurement.internal.duchy"; +option java_multiple_files = true; + +// Parameters for differential privacy (DP). +// +// For detail, refer to "Dwork, C. and Roth, A., 2014. The algorithmic +// foundations of differential privacy. Foundations and Trends in Theoretical +// Computer Science, 9(3-4), pp.211-407." +message DifferentialPrivacyParams { + double epsilon = 1; + double delta = 2; +} diff --git a/src/main/proto/wfa/measurement/protocol/crypto/BUILD.bazel b/src/main/proto/wfa/measurement/internal/duchy/protocol/BUILD.bazel similarity index 61% rename from src/main/proto/wfa/measurement/protocol/crypto/BUILD.bazel rename to src/main/proto/wfa/measurement/internal/duchy/protocol/BUILD.bazel index c6f312f88..8096c5d54 100644 --- a/src/main/proto/wfa/measurement/protocol/crypto/BUILD.bazel +++ b/src/main/proto/wfa/measurement/internal/duchy/protocol/BUILD.bazel @@ -1,10 +1,10 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") -load("@rules_java//java:defs.bzl", "java_proto_library") load("@rules_cc//cc:defs.bzl", "cc_proto_library") +load("@rules_java//java:defs.bzl", "java_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") + +package(default_visibility = ["//:__subpackages__"]) -package(default_visibility = [ - "//visibility:public", -]) +IMPORT_PREFIX = "/src/main/proto" proto_library( name = "liquid_legions_v2_encryption_methods_proto", @@ -42,3 +42,31 @@ java_proto_library( name = "liquid_legions_v2_noise_config_java_proto", deps = [":liquid_legions_v2_noise_config_proto"], ) + +proto_library( + name = "requisition", + srcs = ["requisition.proto"], + strip_import_prefix = IMPORT_PREFIX, +) + +java_proto_library( + name = "requisition_java_proto", + deps = [":requisition"], +) + +proto_library( + name = "liquid_legions_v2_proto", + srcs = ["liquid_legions_sketch_aggregation_v2.proto"], + strip_import_prefix = IMPORT_PREFIX, + deps = [ + ":requisition", + "//src/main/proto/wfa/measurement/internal/duchy:crypto_proto", + "//src/main/proto/wfa/measurement/internal/duchy:differential_privacy_proto", + "//src/main/proto/wfa/measurement/internal/duchy/config:protocols_setup_config_proto", + ], +) + +java_proto_library( + name = "liquid_legions_v2_java_proto", + deps = [":liquid_legions_v2_proto"], +) diff --git a/src/main/proto/wfa/measurement/protocol/liquid_legions_sketch_aggregation_v2.proto b/src/main/proto/wfa/measurement/internal/duchy/protocol/liquid_legions_sketch_aggregation_v2.proto similarity index 55% rename from src/main/proto/wfa/measurement/protocol/liquid_legions_sketch_aggregation_v2.proto rename to src/main/proto/wfa/measurement/internal/duchy/protocol/liquid_legions_sketch_aggregation_v2.proto index 6f0dc226d..4bd1b91f4 100644 --- a/src/main/proto/wfa/measurement/protocol/liquid_legions_sketch_aggregation_v2.proto +++ b/src/main/proto/wfa/measurement/internal/duchy/protocol/liquid_legions_sketch_aggregation_v2.proto @@ -14,12 +14,14 @@ syntax = "proto3"; -package wfa.measurement.protocol; +package wfa.measurement.internal.duchy.protocol; import "wfa/measurement/internal/duchy/config/protocols_setup_config.proto"; -import "wfa/measurement/protocol/requisition.proto"; +import "wfa/measurement/internal/duchy/crypto.proto"; +import "wfa/measurement/internal/duchy/differential_privacy.proto"; +import "wfa/measurement/internal/duchy/protocol/requisition.proto"; -option java_package = "org.wfanet.measurement.protocol"; +option java_package = "org.wfanet.measurement.internal.duchy.protocol"; option java_multiple_files = true; // LiquidLegionsSketchAggregationV2 (3-round MPC) protocol. @@ -28,31 +30,44 @@ message LiquidLegionsSketchAggregationV2 { // The computation stage is unknown. This is never set intentionally. STAGE_UNKNOWN = 0; - // The computation is known and the worker should confirm all required local - // requisitions are available. After confirmation, the computation enters - // WAIT_TO_START at non-aggregator workers or WAIT_SETUP_PHASE_INPUTS at the - // aggregator worker. - CONFIRM_REQUISITIONS_PHASE = 1; + // The worker is in the initialization phase. + // More specifically, each worker will create a new ElGamal key pair solely + // used in this computation, and report the public key to the Kingdom. + INITIALIZATION_PHASE = 1; + + // The computation is initialized locally. The worker is waiting for the + // list of local requisitions and the public ElGamal key set used in this + // computation from the Kingdom. + WAIT_REQUISITIONS_AND_KEY_SET = 2; + + // The worker is in the confirmation phase. + // More specifically, the worker should confirm + // 1. All data providers' participation_signatures are valid. + // 2. All duchies' ElGamal public keys are valid. + // 3. All local fulfilled requisitions are available. + // After confirmation, the computation enters WAIT_SETUP_PHASE_INPUTS at the + // aggregator worker and WAIT_TO_START at non-aggregator workers. + CONFIRMATION_PHASE = 3; // The computation is confirmed locally, and the non-aggregator worker is // waiting for the signal from the kingdom to start the MPC protocol. - WAIT_TO_START = 2; + WAIT_TO_START = 4; // The aggregator worker is waiting for other MPC workers' local combined // register vector (CRV) to start working on the setup phase. - WAIT_SETUP_PHASE_INPUTS = 3; + WAIT_SETUP_PHASE_INPUTS = 5; // The worker is in the setup phase. // More specifically, a non-aggregator worker will add noise to its local // CRV, and send the noised CRV to the aggregator. The aggregator worker // will add noise to its local CRV, and then combine it together with CRVs // received from all other non-aggregator workers and create a global CRV. - SETUP_PHASE = 4; + SETUP_PHASE = 6; // The worker is waiting to receive a copy of global CRV from the previous // worker in the ring of workers to start working on the execution phase // one. - WAIT_EXECUTION_PHASE_ONE_INPUTS = 5; + WAIT_EXECUTION_PHASE_ONE_INPUTS = 7; // The worker is in the execution phase one. // More specifically, a non-aggregator worker will re-encrypt its positional @@ -62,12 +77,12 @@ message LiquidLegionsSketchAggregationV2 { // re-encrypted positional values. Combining is via the same key aggregation // method to create the encrypted flag and count tuples. Then, the // aggregator adds noise to the flag count tuples. - EXECUTION_PHASE_ONE = 6; + EXECUTION_PHASE_ONE = 8; // The worker is waiting to receive a copy of the flag and count tuples from // the previous worker in the ring of workers to start working on the // execution phase two. - WAIT_EXECUTION_PHASE_TWO_INPUTS = 7; + WAIT_EXECUTION_PHASE_TWO_INPUTS = 9; // The worker is in the execution phase two. // More specifically, a non-aggregator worker decrypts the flag and add @@ -75,22 +90,22 @@ message LiquidLegionsSketchAggregationV2 { // decrypts the flags and filters out non-DP noises and then estimates the // reach, then discards the destroyed registers and creates a 2-D // SameKeyAggregator (SKA) matrix for the un-destroyed counters. - EXECUTION_PHASE_TWO = 8; + EXECUTION_PHASE_TWO = 10; // The worker is waiting to receive a copy of the SKA matrix from the // previous worker in the ring of workers to start working on the execution // phase three. - WAIT_EXECUTION_PHASE_THREE_INPUTS = 9; + WAIT_EXECUTION_PHASE_THREE_INPUTS = 11; // The worker is in the execution phase three. // More specifically, a non-aggregator worker decrypts the SKA matrix, and // the aggregator worker decrypts the SKA matrix and computes the final // frequency histogram. - EXECUTION_PHASE_THREE = 10; + EXECUTION_PHASE_THREE = 12; // The computation is done the worker can remove BLOBs that are no longer // needed. - COMPLETE = 11; + COMPLETE = 13; } // Computation details specific to the LiquidLegions V2 protocol. @@ -99,9 +114,60 @@ message LiquidLegionsSketchAggregationV2 { org.wfa.measurement.config.LiquidLegionsV2SetupConfig.RoleInComputation role = 1; - // The list of ordered duchy ids in the MPC ring, with the first element - // being the first non-aggregator and the last element being the aggregator. - repeated string duchy_order = 2; + // Parameters used in this computation. + message Parameters { + // The maximum frequency to reveal in the histogram. + int32 maximum_frequency = 1; + // The decay rate of the Liquid Legions sketch. + double decay_rate = 2; + // The maximum size of the Liquid Legions sketch. + int64 max_size = 3; + // Noise parameters selected for the LiquidLegionV2 MPC protocol. + // Only used as the configuration file consumed by the LiquidLegionV2Mill. + message NoiseConfig { + // DP params for the blind histogram noise register. + // Each of these registers contains a random register id, the same + // constant key indicating that the register is destroyed, and an + // arbitrary count value. + DifferentialPrivacyParams blind_histogram_noise = 1; + // DP params for the noise for the publisher noise registers. + // Each of these registers contains a well-known constant register id, + // and arbitrary key and count values. + DifferentialPrivacyParams noise_for_publisher_noise = 2; + // DP params for the global reach DP noise registers. + // Each of these registers contains a random register id which is out of + // bounds of the normal id space, the same constant key indicating that + // the register is destroyed, and an arbitrary count value. + DifferentialPrivacyParams global_reach_dp_noise = 3; + // Differential privacy parameters for noise tuples. + // Same value is used for both (0, R, R) and (R, R, R) tuples. + DifferentialPrivacyParams frequency_noise_config = 4; + } + // Noise parameters selected for the LiquidLegionV2 MPC protocol. + NoiseConfig noise = 4; + // ID of the OpenSSL built-in elliptic curve. For example, 415 for the + // prime256v1 curve. Required. Immutable. + int32 elliptic_curve_id = 5; + } + Parameters parameters = 2; + + message ComputationParticipant { + // Name of the duchy who owns the key. + string duchy_id = 1; + // The ElGamal public key. + ElGamalPublicKey public_key = 2; + // Serialized `ElGamalPublicKey` message from public API. + // For consent signaling verification only. + bytes el_gamal_public_key = 3; + // Cryptographic digital signature of `el_gamal_public_key`. + // For consent signaling verification only. + bytes el_gamal_public_key_signature = 4; + } + // The list of duchies participating this computation. + // The list is sorted by the duchy order in the MPC ring, with the first + // element being the first non-aggregator and the last element being the + // aggregator. + repeated ComputationParticipant participant = 3; message ReachEstimate { int64 reach = 1; @@ -111,11 +177,12 @@ message LiquidLegionsSketchAggregationV2 { // the aggregator. It is only set at the aggregator and is not shared with // non-aggregator nodes. The value will be included in the result for the // computation. - ReachEstimate reach_estimate = 3; + ReachEstimate reach_estimate = 4; // Total number of MetricRequisitions across all duchies used in this // computation. - int32 total_requisition_count = 4; + // TODO(wangyaopw): delete after v2alpha is done + int32 total_requisition_count = 5; } // Details about a particular attempt of running a stage of the LiquidLegionV2 @@ -124,6 +191,7 @@ message LiquidLegionsSketchAggregationV2 { oneof detail { // Details specific to the WAIT_SETUP_PHASE_INPUTS stage. WaitSetupPhaseInputsDetails wait_setup_phase_inputs_details = 1; + // TODO(wangyaopw): delete after v2alpha is done. // Details specific to the TO_CONFIRM_REQUISITIONS stage. ToConfirmRequisitionsStageDetails to_confirm_requisitions_stage_details = 2; @@ -144,9 +212,10 @@ message LiquidLegionsSketchAggregationV2 { map external_duchy_local_blob_id = 1; } + // TODO(wangyaopw): delete after v2alpha is done // The details used to run a TO_CONFIRM_REQUISITIONS stage. message ToConfirmRequisitionsStageDetails { // list of local requisitions that are required for this computation. repeated RequisitionKey keys = 1; } -} +} \ No newline at end of file diff --git a/src/main/proto/wfa/measurement/protocol/crypto/liquid_legions_v2_encryption_methods.proto b/src/main/proto/wfa/measurement/internal/duchy/protocol/liquid_legions_v2_encryption_methods.proto similarity index 95% rename from src/main/proto/wfa/measurement/protocol/crypto/liquid_legions_v2_encryption_methods.proto rename to src/main/proto/wfa/measurement/internal/duchy/protocol/liquid_legions_v2_encryption_methods.proto index 78ef68402..d58498f39 100644 --- a/src/main/proto/wfa/measurement/protocol/crypto/liquid_legions_v2_encryption_methods.proto +++ b/src/main/proto/wfa/measurement/internal/duchy/protocol/liquid_legions_v2_encryption_methods.proto @@ -14,13 +14,14 @@ syntax = "proto3"; -package wfa.measurement.protocol; +package wfa.measurement.internal.duchy.protocol; +// TODO(wangyaopw): use local protos insteaded from common. import "wfa/common/el_gamal_key.proto"; import "wfa/common/liquid_legions.proto"; import "wfa/common/noise_parameters.proto"; -option java_package = "org.wfanet.measurement.protocol"; +option java_package = "org.wfanet.measurement.internal.duchy.protocol"; option java_multiple_files = true; // Proto messages wrapping the input arguments or output results of the liquid @@ -84,6 +85,20 @@ message PerBucketFrequencyDpNoiseBaseline { wfa.common.DifferentialPrivacyParams dp_params = 2; } +// The request to complete work in the initialization phase. +message CompleteInitializationPhaseRequest { + // The elliptical curve to work on. + int64 curve_id = 1; +} + +// Response of the CompleteInitializationPhase method. +message CompleteInitializationPhaseResponse { + // A randomly created ElGamal Key pair. + wfa.common.ElGamalKeyPair el_gamal_key_pair = 1; + // The CPU time of processing the request. + int64 elapsed_cpu_time_millis = 2; +} + // The request to complete work in the setup phase. message CompleteSetupPhaseRequest { // The input combined register vector (CRV) diff --git a/src/main/proto/wfa/measurement/protocol/crypto/liquid_legions_v2_noise_config.proto b/src/main/proto/wfa/measurement/internal/duchy/protocol/liquid_legions_v2_noise_config.proto similarity index 91% rename from src/main/proto/wfa/measurement/protocol/crypto/liquid_legions_v2_noise_config.proto rename to src/main/proto/wfa/measurement/internal/duchy/protocol/liquid_legions_v2_noise_config.proto index 37797fd27..5684a8675 100644 --- a/src/main/proto/wfa/measurement/protocol/crypto/liquid_legions_v2_noise_config.proto +++ b/src/main/proto/wfa/measurement/internal/duchy/protocol/liquid_legions_v2_noise_config.proto @@ -14,15 +14,16 @@ syntax = "proto3"; -package wfa.measurement.protocol; +package wfa.measurement.internal.duchy.protocol; import "wfa/common/noise_parameters.proto"; -option java_package = "org.wfanet.measurement.protocol"; +option java_package = "org.wfanet.measurement.internal.duchy.protocol"; option java_multiple_files = true; // Noise parameters selected for the LiquidLegionV2 MPC protocol. // Only used as the configuration file consumed by the LiquidLegionV2Mill. +// TODO(wangyaopw): delete this one when not used after v2 alpha is done. message LiquidLegionsV2NoiseConfig { message ReachNoiseConfig { // DP params for the blind histogram noise register. diff --git a/src/main/proto/wfa/measurement/protocol/requisition.proto b/src/main/proto/wfa/measurement/internal/duchy/protocol/requisition.proto similarity index 83% rename from src/main/proto/wfa/measurement/protocol/requisition.proto rename to src/main/proto/wfa/measurement/internal/duchy/protocol/requisition.proto index 648b7072e..e3faf7c30 100644 --- a/src/main/proto/wfa/measurement/protocol/requisition.proto +++ b/src/main/proto/wfa/measurement/internal/duchy/protocol/requisition.proto @@ -14,12 +14,13 @@ syntax = "proto3"; -package wfa.measurement.protocol; +package wfa.measurement.internal.duchy.protocol; -option java_package = "org.wfanet.measurement.protocol"; +option java_package = "org.wfanet.measurement.internal.duchy.protocol"; option java_multiple_files = true; // The keys to identity a requisition in the MetricValue database +// TODO(wangyaopw): delete when v2 alpha is done. message RequisitionKey { string data_provider_id = 1; string campaign_id = 2; diff --git a/src/main/proto/wfa/measurement/internal/duchy/requisition_details.proto b/src/main/proto/wfa/measurement/internal/duchy/requisition_details.proto new file mode 100644 index 000000000..ae12d8666 --- /dev/null +++ b/src/main/proto/wfa/measurement/internal/duchy/requisition_details.proto @@ -0,0 +1,42 @@ +// Copyright 2021 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. + +syntax = "proto3"; + +package wfa.measurement.internal.duchy; + +option java_package = "org.wfanet.measurement.internal.duchy"; +option java_multiple_files = true; + +// The details of requisition used in a computation. +message RequisitionDetails { + // X.509 certificate in DER format which can be verified using the + // `DataProvider`'s root certificate. Required. Immutable. + bytes data_provider_certificate = 1; + // SHA256 hash of encrypted `RequisitionSpec` from public API. Required. + // Immutable. + bytes requisition_spec_hash = 2; + // Cryptographic digital signature of the "requisition fingerprint" which + // can be verified using `data_provider_certificate`. Set when `state` is + // `FULFILLED`. + // + // The requisition fingerprint is defined as the concatenation of: + // 1. `requisition_spec_hash` + // 2. The SHA256 hash of the concatenation of `data_provider_list` and + // `data_provider_list_salt` from the parent `Computation`. + // 3. `measurement_spec` from the parent `Computation`. + bytes data_provider_participation_signature = 3; + // External ID of the duchy where this requisition is fulfilled. + string external_fulfilling_duchy_id = 4; +} \ No newline at end of file diff --git a/src/main/proto/wfa/measurement/protocol/BUILD.bazel b/src/main/proto/wfa/measurement/protocol/BUILD.bazel deleted file mode 100644 index 6125abc43..000000000 --- a/src/main/proto/wfa/measurement/protocol/BUILD.bazel +++ /dev/null @@ -1,32 +0,0 @@ -load("@rules_java//java:defs.bzl", "java_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") - -package(default_visibility = ["//:__subpackages__"]) - -IMPORT_PREFIX = "/src/main/proto" - -proto_library( - name = "requisition", - srcs = ["requisition.proto"], - strip_import_prefix = IMPORT_PREFIX, -) - -java_proto_library( - name = "requisition_java_proto", - deps = [":requisition"], -) - -proto_library( - name = "liquid_legions_v2_proto", - srcs = ["liquid_legions_sketch_aggregation_v2.proto"], - strip_import_prefix = IMPORT_PREFIX, - deps = [ - ":requisition", - "//src/main/proto/wfa/measurement/internal/duchy/config:protocols_setup_config_proto", - ], -) - -java_proto_library( - name = "liquid_legions_v2_java_proto", - deps = [":liquid_legions_v2_proto"], -) diff --git a/src/main/swig/protocol/liquidlegionsv2/BUILD.bazel b/src/main/swig/protocol/liquidlegionsv2/BUILD.bazel index db3678cf8..c8dda4ab3 100644 --- a/src/main/swig/protocol/liquidlegionsv2/BUILD.bazel +++ b/src/main/swig/protocol/liquidlegionsv2/BUILD.bazel @@ -9,8 +9,8 @@ java_wrap_cc( name = "liquid_legions_v2_encryption_utility", src = "liquid_legions_v2_encryption_utility.swig", module = "LiquidLegionsV2EncryptionUtility", - package = "org.wfanet.measurement.protocol.liquidlegionsv2", + package = "org.wfanet.measurement.internal.duchy.protocol.liquidlegionsv2", deps = [ - "//src/main/cc/wfa/measurement/protocol/liquid_legions_v2:liquid_legions_v2_encryption_utility_wrapper", + "//src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2:liquid_legions_v2_encryption_utility_wrapper", ], ) diff --git a/src/main/swig/protocol/liquidlegionsv2/liquid_legions_v2_encryption_utility.swig b/src/main/swig/protocol/liquidlegionsv2/liquid_legions_v2_encryption_utility.swig index 1cfd117b3..0b19c7286 100644 --- a/src/main/swig/protocol/liquidlegionsv2/liquid_legions_v2_encryption_utility.swig +++ b/src/main/swig/protocol/liquidlegionsv2/liquid_legions_v2_encryption_utility.swig @@ -14,7 +14,7 @@ %include "exception.i" %{ -#include "wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.h" +#include "wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.h" %} // Convert C++ ::absl::StatusOr to a Java byte @@ -64,4 +64,4 @@ // Follow Java style for function names. %rename("%(lowercamelcase)s",%$isfunction) ""; -%include "wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.h" +%include "wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_wrapper.h" diff --git a/src/test/cc/wfa/measurement/protocol/liquid_legions_v2/BUILD.bazel b/src/test/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/BUILD.bazel similarity index 84% rename from src/test/cc/wfa/measurement/protocol/liquid_legions_v2/BUILD.bazel rename to src/test/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/BUILD.bazel index 951352557..8555df294 100644 --- a/src/test/cc/wfa/measurement/protocol/liquid_legions_v2/BUILD.bazel +++ b/src/test/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/BUILD.bazel @@ -8,7 +8,7 @@ cc_test( "liquid_legions_v2_encryption_utility_test.cc", ], deps = [ - "//src/main/cc/wfa/measurement/protocol/liquid_legions_v2:liquid_legions_v2_encryption_utility", + "//src/main/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2:liquid_legions_v2_encryption_utility", "//src/test/cc/testutil:matchers", "//src/test/cc/testutil:status_macros", "@any_sketch//src/main/cc/any_sketch/crypto:sketch_encrypter", diff --git a/src/test/cc/wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_test.cc b/src/test/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_test.cc similarity index 99% rename from src/test/cc/wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_test.cc rename to src/test/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_test.cc index 8831e5329..f5945419e 100644 --- a/src/test/cc/wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_test.cc +++ b/src/test/cc/wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "wfa/measurement/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.h" +#include "wfa/measurement/internal/duchy/protocol/liquid_legions_v2/liquid_legions_v2_encryption_utility.h" #include @@ -31,9 +31,9 @@ #include "wfa/measurement/common/crypto/constants.h" #include "wfa/measurement/common/crypto/ec_point_util.h" #include "wfa/measurement/common/crypto/encryption_utility_helper.h" -#include "wfa/measurement/protocol/crypto/liquid_legions_v2_encryption_methods.pb.h" +#include "wfa/measurement/internal/duchy/protocol/liquid_legions_v2_encryption_methods.pb.h" -namespace wfa::measurement::protocol::liquid_legions_v2 { +namespace wfa::measurement::internal::duchy::protocol::liquid_legions_v2 { namespace { using ::private_join_and_compute::BigNum; @@ -1143,4 +1143,4 @@ TEST(EndToEnd, CombinedCasesWithDeterministicReachAndFrequencyDpNoises) { } } // namespace -} // namespace wfa::measurement::protocol::liquid_legions_v2 +} // namespace wfa::measurement::internal::duchy::protocol::liquid_legions_v2 diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/daemon/herald/HeraldTest.kt b/src/test/kotlin/org/wfanet/measurement/duchy/daemon/herald/HeraldTest.kt index d8979946c..15ea13834 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/daemon/herald/HeraldTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/duchy/daemon/herald/HeraldTest.kt @@ -42,10 +42,10 @@ import org.wfanet.measurement.internal.duchy.ComputationStageDetails import org.wfanet.measurement.internal.duchy.ComputationsGrpcKt.ComputationsCoroutineStub import org.wfanet.measurement.internal.duchy.config.LiquidLegionsV2SetupConfig.RoleInComputation import org.wfanet.measurement.internal.duchy.config.ProtocolsSetupConfig -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.CONFIRM_REQUISITIONS_PHASE -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.SETUP_PHASE -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_TO_START -import org.wfanet.measurement.protocol.RequisitionKey +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.CONFIRMATION_PHASE +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.SETUP_PHASE +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_TO_START +import org.wfanet.measurement.internal.duchy.protocol.RequisitionKey import org.wfanet.measurement.system.v1alpha.GlobalComputation import org.wfanet.measurement.system.v1alpha.GlobalComputationsGrpcKt.GlobalComputationsCoroutineImplBase import org.wfanet.measurement.system.v1alpha.GlobalComputationsGrpcKt.GlobalComputationsCoroutineStub @@ -138,7 +138,7 @@ internal class HeraldTest { fakeComputationStorage.addComputation( globalId = confirmingKnown.globalId, - stage = CONFIRM_REQUISITIONS_PHASE.toProtocolStage(), + stage = CONFIRMATION_PHASE.toProtocolStage(), computationDetails = aggregatorComputationDetails, blobs = listOf(newInputBlobMetadata(0L, "input-blob"), newEmptyOutputBlobMetadata(1L)) ) @@ -152,9 +152,9 @@ internal class HeraldTest { ) .containsExactly( confirmingKnown.globalId.toLong(), - CONFIRM_REQUISITIONS_PHASE.toProtocolStage(), + CONFIRMATION_PHASE.toProtocolStage(), confirmingUnknown.globalId.toLong(), - CONFIRM_REQUISITIONS_PHASE.toProtocolStage() + CONFIRMATION_PHASE.toProtocolStage() ) assertThat(fakeComputationStorage[confirmingUnknown.globalId.toLong()]?.stageSpecificDetails) @@ -227,7 +227,7 @@ internal class HeraldTest { fakeComputationStorage.addComputation( globalId = computation.globalId, - stage = CONFIRM_REQUISITIONS_PHASE.toProtocolStage(), + stage = CONFIRMATION_PHASE.toProtocolStage(), computationDetails = nonAggregatorComputationDetails, blobs = listOf(newInputBlobMetadata(0L, "local-copy-of-sketches")) ) @@ -240,7 +240,7 @@ internal class HeraldTest { fakeComputation.computationStage } ) - .containsExactly(computation.globalId.toLong(), CONFIRM_REQUISITIONS_PHASE.toProtocolStage()) + .containsExactly(computation.globalId.toLong(), CONFIRMATION_PHASE.toProtocolStage()) // Update the state. fakeComputationStorage.remove(computation.globalId.toLong()) @@ -282,7 +282,7 @@ internal class HeraldTest { fakeComputationStorage.addComputation( globalId = computation.globalId, - stage = CONFIRM_REQUISITIONS_PHASE.toProtocolStage(), + stage = CONFIRMATION_PHASE.toProtocolStage(), computationDetails = nonAggregatorComputationDetails, blobs = listOf(newInputBlobMetadata(0L, "local-copy-of-sketches")) ) diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/BUILD.bazel b/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/BUILD.bazel index c24a59a2b..c3110862c 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/BUILD.bazel +++ b/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/BUILD.bazel @@ -16,7 +16,7 @@ kt_jvm_test( "//src/main/kotlin/org/wfanet/measurement/duchy/storage:computation_store", "//src/main/kotlin/org/wfanet/measurement/duchy/testing", "//src/main/kotlin/org/wfanet/measurement/storage/filesystem:client", - "//src/main/proto/wfa/measurement/protocol/crypto:liquid_legions_v2_encryption_methods_java_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_encryption_methods_java_proto", "//src/main/swig/protocol/liquidlegionsv2:liquid_legions_v2_encryption_utility", ], ) diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/LiquidLegionsV2MillTest.kt b/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/LiquidLegionsV2MillTest.kt index b40f2f31f..1cd2eb16d 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/LiquidLegionsV2MillTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/LiquidLegionsV2MillTest.kt @@ -84,33 +84,33 @@ import org.wfanet.measurement.internal.duchy.MetricValuesGrpcKt.MetricValuesCoro import org.wfanet.measurement.internal.duchy.StreamMetricValueRequest import org.wfanet.measurement.internal.duchy.StreamMetricValueResponse import org.wfanet.measurement.internal.duchy.config.LiquidLegionsV2SetupConfig.RoleInComputation -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneAtAggregatorRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneAtAggregatorResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeAtAggregatorRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeAtAggregatorResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoAtAggregatorRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoAtAggregatorResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoResponse -import org.wfanet.measurement.protocol.CompleteSetupPhaseRequest -import org.wfanet.measurement.protocol.CompleteSetupPhaseResponse -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.COMPLETE -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.CONFIRM_REQUISITIONS_PHASE -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.EXECUTION_PHASE_ONE -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.EXECUTION_PHASE_THREE -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.EXECUTION_PHASE_TWO -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.SETUP_PHASE -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_EXECUTION_PHASE_ONE_INPUTS -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_EXECUTION_PHASE_THREE_INPUTS -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_EXECUTION_PHASE_TWO_INPUTS -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_SETUP_PHASE_INPUTS -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_TO_START -import org.wfanet.measurement.protocol.LiquidLegionsV2NoiseConfig -import org.wfanet.measurement.protocol.RequisitionKey +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneAtAggregatorRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneAtAggregatorResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeAtAggregatorRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeAtAggregatorResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoAtAggregatorRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoAtAggregatorResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteSetupPhaseRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteSetupPhaseResponse +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.COMPLETE +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.CONFIRMATION_PHASE +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.EXECUTION_PHASE_ONE +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.EXECUTION_PHASE_THREE +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.EXECUTION_PHASE_TWO +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.SETUP_PHASE +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_EXECUTION_PHASE_ONE_INPUTS +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_EXECUTION_PHASE_THREE_INPUTS +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_EXECUTION_PHASE_TWO_INPUTS +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_SETUP_PHASE_INPUTS +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage.WAIT_TO_START +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsV2NoiseConfig +import org.wfanet.measurement.internal.duchy.protocol.RequisitionKey import org.wfanet.measurement.storage.filesystem.FileSystemStorageClient import org.wfanet.measurement.storage.read import org.wfanet.measurement.system.v1alpha.AdvanceComputationRequest @@ -355,7 +355,7 @@ class LiquidLegionsV2MillTest { // Stage 0. preparing the storage and set up mock fakeComputationDb.addComputation( globalId = GLOBAL_ID, - stage = CONFIRM_REQUISITIONS_PHASE.toProtocolStage(), + stage = CONFIRMATION_PHASE.toProtocolStage(), computationDetails = aggregatorComputationDetails, blobs = listOf(newEmptyOutputBlobMetadata(0L)) ) @@ -410,7 +410,7 @@ class LiquidLegionsV2MillTest { // Stage 0. preparing the storage and set up mock fakeComputationDb.addComputation( globalId = GLOBAL_ID, - stage = CONFIRM_REQUISITIONS_PHASE.toProtocolStage(), + stage = CONFIRMATION_PHASE.toProtocolStage(), computationDetails = nonAggregatorComputationDetails, blobs = listOf(newEmptyOutputBlobMetadata(0L)), stageDetails = @@ -493,7 +493,7 @@ class LiquidLegionsV2MillTest { val requisition2 = "2" fakeComputationDb.addComputation( globalId = GLOBAL_ID, - stage = CONFIRM_REQUISITIONS_PHASE.toProtocolStage(), + stage = CONFIRMATION_PHASE.toProtocolStage(), computationDetails = nonAggregatorComputationDetails, blobs = listOf(newEmptyOutputBlobMetadata(0L)), stageDetails = @@ -573,13 +573,12 @@ class LiquidLegionsV2MillTest { selfReportedIdentifier = MILL_ID stageDetailsBuilder.apply { algorithm = MpcAlgorithm.LIQUID_LEGIONS_V2 - stageNumber = CONFIRM_REQUISITIONS_PHASE.number.toLong() - stageName = CONFIRM_REQUISITIONS_PHASE.name + stageNumber = CONFIRMATION_PHASE.number.toLong() + stageName = CONFIRMATION_PHASE.name attemptNumber = 1 } updateMessage = - "Computation $GLOBAL_ID at stage CONFIRM_REQUISITIONS_PHASE," + - " attempt 1 failed." + "Computation $GLOBAL_ID at stage CONFIRMATION_PHASE," + " attempt 1 failed." errorDetailsBuilder.apply { errorType = ErrorType.PERMANENT } } } diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/BUILD.bazel b/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/BUILD.bazel index 94694e293..8789a312f 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/BUILD.bazel +++ b/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/BUILD.bazel @@ -11,7 +11,7 @@ kt_jvm_test( "//imports/kotlin/kotlin/test", "//src/main/kotlin/org/wfanet/measurement/common", "//src/main/proto/wfa/measurement/api/v1alpha:sketch_java_proto", - "//src/main/proto/wfa/measurement/protocol/crypto:liquid_legions_v2_encryption_methods_java_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_encryption_methods_java_proto", "//src/main/swig/protocol/liquidlegionsv2:liquid_legions_v2_encryption_utility", "@any_sketch_java//src/main/java/org/wfanet/anysketch/crypto:sketch_encrypter_adapter", "@any_sketch_java//src/main/proto/wfa/any_sketch/crypto:sketch_encryption_methods_java_proto", @@ -26,6 +26,6 @@ kt_jvm_test( "//imports/java/com/google/common/truth", "//imports/kotlin/kotlin/test", "//src/main/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto:liquidlegionsv2encryption", - "//src/main/proto/wfa/measurement/protocol/crypto:liquid_legions_v2_encryption_methods_java_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_encryption_methods_java_proto", ], ) diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/JniLiquidLegionsV2EncryptionTest.kt b/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/JniLiquidLegionsV2EncryptionTest.kt index 4f8a9b6df..ce14108da 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/JniLiquidLegionsV2EncryptionTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/JniLiquidLegionsV2EncryptionTest.kt @@ -17,7 +17,7 @@ package org.wfanet.measurement.duchy.daemon.mill.liquidlegionsv2.crypto import com.google.common.truth.Truth.assertThat import kotlin.test.assertFailsWith import org.junit.Test -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoRequest class JniLiquidLegionsV2EncryptionTest { diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/LiquidLegionsV2EncryptionUtilityTest.kt b/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/LiquidLegionsV2EncryptionUtilityTest.kt index 7404a17e5..f08678866 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/LiquidLegionsV2EncryptionUtilityTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/duchy/daemon/mill/liquidlegionsv2/crypto/LiquidLegionsV2EncryptionUtilityTest.kt @@ -30,21 +30,21 @@ import org.wfanet.measurement.api.v1alpha.Sketch import org.wfanet.measurement.api.v1alpha.SketchConfig.ValueSpec.Aggregator import org.wfanet.measurement.common.hexAsByteString import org.wfanet.measurement.common.loadLibrary -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneAtAggregatorRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneAtAggregatorResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseOneResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeAtAggregatorRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeAtAggregatorResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseThreeResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoAtAggregatorRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoAtAggregatorResponse -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoRequest -import org.wfanet.measurement.protocol.CompleteExecutionPhaseTwoResponse -import org.wfanet.measurement.protocol.CompleteSetupPhaseRequest -import org.wfanet.measurement.protocol.CompleteSetupPhaseResponse -import org.wfanet.measurement.protocol.liquidlegionsv2.LiquidLegionsV2EncryptionUtility +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneAtAggregatorRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneAtAggregatorResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseOneResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeAtAggregatorRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeAtAggregatorResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseThreeResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoAtAggregatorRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoAtAggregatorResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteExecutionPhaseTwoResponse +import org.wfanet.measurement.internal.duchy.protocol.CompleteSetupPhaseRequest +import org.wfanet.measurement.internal.duchy.protocol.CompleteSetupPhaseResponse +import org.wfanet.measurement.internal.duchy.protocol.liquidlegionsv2.LiquidLegionsV2EncryptionUtility @RunWith(JUnit4::class) class LiquidLegionsV2EncryptionUtilityTest { diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/BUILD.bazel b/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/BUILD.bazel index abf5cf60f..a3a022d1e 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/BUILD.bazel +++ b/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/BUILD.bazel @@ -49,7 +49,7 @@ kt_jvm_test( "//imports/java/org/junit", "//imports/kotlin/kotlin/test", "//src/main/kotlin/org/wfanet/measurement/duchy/db/computation", - "//src/main/proto/wfa/measurement/protocol:liquid_legions_v2_java_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_java_proto", ], ) @@ -63,6 +63,6 @@ kt_jvm_test( "//imports/java/org/junit", "//imports/kotlin/kotlin/test", "//src/main/kotlin/org/wfanet/measurement/duchy/db/computation", - "//src/main/proto/wfa/measurement/protocol:liquid_legions_v2_java_proto", + "//src/main/proto/wfa/measurement/internal/duchy/protocol:liquid_legions_v2_java_proto", ], ) diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/ComputationDataClientsTest.kt b/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/ComputationDataClientsTest.kt index 871a688c0..fca063e87 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/ComputationDataClientsTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/ComputationDataClientsTest.kt @@ -48,7 +48,7 @@ import org.wfanet.measurement.internal.duchy.EnqueueComputationRequest import org.wfanet.measurement.internal.duchy.FinishComputationRequest import org.wfanet.measurement.internal.duchy.RecordOutputBlobPathRequest import org.wfanet.measurement.internal.duchy.config.LiquidLegionsV2SetupConfig -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage import org.wfanet.measurement.storage.StorageClient import org.wfanet.measurement.system.v1alpha.GlobalComputationsGrpcKt.GlobalComputationsCoroutineStub @@ -145,7 +145,7 @@ class ComputationDataClientsTest { val fakeRpcService = computation.FakeRpcService() computation.enqueue() computation.claimWorkFor("mill-1") - computation.writeOutputs(Stage.CONFIRM_REQUISITIONS_PHASE) + computation.writeOutputs(Stage.CONFIRMATION_PHASE) computation.runWaitStage(Stage.WAIT_TO_START, numOfOutput = 0) computation.start() @@ -190,7 +190,7 @@ class ComputationDataClientsTest { computation.enqueue() computation.claimWorkFor("mill-1") - computation.writeOutputs(Stage.CONFIRM_REQUISITIONS_PHASE) + computation.writeOutputs(Stage.CONFIRMATION_PHASE) computation.waitForSketches( LiquidLegionsSketchAggregationV2Protocol.EnumStages.Details(DUCHIES.subList(1, 3)) .detailsFor(Stage.WAIT_SETUP_PHASE_INPUTS) diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/ComputationsEnumHelperTest.kt b/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/ComputationsEnumHelperTest.kt index 107699f8f..27a94f943 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/ComputationsEnumHelperTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/ComputationsEnumHelperTest.kt @@ -18,7 +18,7 @@ import kotlin.test.assertEquals import kotlin.test.assertFails import org.junit.Test import org.wfanet.measurement.internal.duchy.ComputationStage -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2 +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2 class ComputationsEnumHelperTest { diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/LiquidLegionsSketchAggregationV2ProtocolEnumStagesDetailsTest.kt b/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/LiquidLegionsSketchAggregationV2ProtocolEnumStagesDetailsTest.kt index d171eefc2..27e903ed7 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/LiquidLegionsSketchAggregationV2ProtocolEnumStagesDetailsTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/LiquidLegionsSketchAggregationV2ProtocolEnumStagesDetailsTest.kt @@ -19,7 +19,7 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 import org.wfanet.measurement.internal.duchy.ComputationStageDetails -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2 +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2 @RunWith(JUnit4::class) class LiquidLegionsSketchAggregationV2ProtocolEnumStagesDetailsTest { diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/LiquidLegionsSketchAggregationV2ProtocolEnumStagesTest.kt b/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/LiquidLegionsSketchAggregationV2ProtocolEnumStagesTest.kt index e459b3e79..9aa6fc62c 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/LiquidLegionsSketchAggregationV2ProtocolEnumStagesTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/duchy/db/computation/LiquidLegionsSketchAggregationV2ProtocolEnumStagesTest.kt @@ -21,7 +21,7 @@ import kotlin.test.assertTrue import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2 +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2 @RunWith(JUnit4::class) class LiquidLegionsSketchAggregationV2ProtocolEnumStagesTest { @@ -29,7 +29,7 @@ class LiquidLegionsSketchAggregationV2ProtocolEnumStagesTest { fun `verify initial stage`() { assertTrue { LiquidLegionsSketchAggregationV2Protocol.EnumStages.validInitialStage( - LiquidLegionsSketchAggregationV2.Stage.CONFIRM_REQUISITIONS_PHASE + LiquidLegionsSketchAggregationV2.Stage.CONFIRMATION_PHASE ) } assertFalse { @@ -87,14 +87,14 @@ class LiquidLegionsSketchAggregationV2ProtocolEnumStagesTest { assertFalse { LiquidLegionsSketchAggregationV2Protocol.EnumStages.validTransition( LiquidLegionsSketchAggregationV2.Stage.STAGE_UNKNOWN, - LiquidLegionsSketchAggregationV2.Stage.CONFIRM_REQUISITIONS_PHASE + LiquidLegionsSketchAggregationV2.Stage.CONFIRMATION_PHASE ) } assertFalse { LiquidLegionsSketchAggregationV2Protocol.EnumStages.validTransition( LiquidLegionsSketchAggregationV2.Stage.UNRECOGNIZED, - LiquidLegionsSketchAggregationV2.Stage.CONFIRM_REQUISITIONS_PHASE + LiquidLegionsSketchAggregationV2.Stage.CONFIRMATION_PHASE ) } } diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/deploy/gcloud/spanner/computation/ComputationsSchemaTest.kt b/src/test/kotlin/org/wfanet/measurement/duchy/deploy/gcloud/spanner/computation/ComputationsSchemaTest.kt index ed2a9fb5d..b46816be1 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/deploy/gcloud/spanner/computation/ComputationsSchemaTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/duchy/deploy/gcloud/spanner/computation/ComputationsSchemaTest.kt @@ -80,6 +80,10 @@ class ComputationsSchemaTest : UsingSpannerEmulator(COMPUTATIONS_SCHEMA) { .to("567") .set("PathToBlob") .to("a/b/c") + .set("RequisitionDetails") + .to(ByteArray.copyFrom("123456")) + .set("RequisitionDetailsJSON") + .to("123456") .build() dbClient.write(listOf(mutation, computationStageChildMutation, requisitionsChildMutation)) assertQueryReturns( @@ -96,7 +100,10 @@ class ComputationsSchemaTest : UsingSpannerEmulator(COMPUTATIONS_SCHEMA) { ) assertQueryReturns( dbClient, - "SELECT ComputationId, RequisitionId, PathToBlob FROM Requisitions", + """ + SELECT ComputationId, RequisitionId, PathToBlob, RequisitionDetails, RequisitionDetailsJSON + FROM Requisitions + """.trimIndent(), Struct.newBuilder() .set("ComputationId") .to(computationId) @@ -104,6 +111,10 @@ class ComputationsSchemaTest : UsingSpannerEmulator(COMPUTATIONS_SCHEMA) { .to(2) .set("PathToBlob") .to("a/b/c") + .set("RequisitionDetails") + .to(ByteArray.copyFrom("123456")) + .set("RequisitionDetailsJSON") + .to("123456") .build() ) } diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/deploy/gcloud/spanner/computation/GcpSpannerComputationsDatabaseReaderTest.kt b/src/test/kotlin/org/wfanet/measurement/duchy/deploy/gcloud/spanner/computation/GcpSpannerComputationsDatabaseReaderTest.kt index f3ed72d4e..dd1829818 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/deploy/gcloud/spanner/computation/GcpSpannerComputationsDatabaseReaderTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/duchy/deploy/gcloud/spanner/computation/GcpSpannerComputationsDatabaseReaderTest.kt @@ -38,7 +38,7 @@ import org.wfanet.measurement.internal.duchy.ComputationStage import org.wfanet.measurement.internal.duchy.ComputationToken import org.wfanet.measurement.internal.duchy.ComputationTypeEnum.ComputationType import org.wfanet.measurement.internal.duchy.config.LiquidLegionsV2SetupConfig -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage @RunWith(JUnit4::class) class GcpSpannerComputationsDatabaseReaderTest : UsingSpannerEmulator(COMPUTATIONS_SCHEMA) { diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computation/ComputationsServiceTest.kt b/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computation/ComputationsServiceTest.kt index c2f7d5e36..09e4d2cf6 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computation/ComputationsServiceTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computation/ComputationsServiceTest.kt @@ -38,7 +38,7 @@ import org.wfanet.measurement.internal.duchy.GetComputationIdsResponse import org.wfanet.measurement.internal.duchy.RecordOutputBlobPathRequest import org.wfanet.measurement.internal.duchy.UpdateComputationDetailsRequest import org.wfanet.measurement.internal.duchy.config.LiquidLegionsV2SetupConfig.RoleInComputation -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2 +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2 import org.wfanet.measurement.system.v1alpha.CreateGlobalComputationStatusUpdateRequest import org.wfanet.measurement.system.v1alpha.GlobalComputationStatusUpdate import org.wfanet.measurement.system.v1alpha.GlobalComputationsGrpcKt.GlobalComputationsCoroutineImplBase diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computationcontrol/AsyncComputationControlServiceTest.kt b/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computationcontrol/AsyncComputationControlServiceTest.kt index 1ecd21503..58680d212 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computationcontrol/AsyncComputationControlServiceTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computationcontrol/AsyncComputationControlServiceTest.kt @@ -45,7 +45,7 @@ import org.wfanet.measurement.internal.duchy.ComputationsGrpcKt.ComputationsCoro import org.wfanet.measurement.internal.duchy.ComputationsGrpcKt.ComputationsCoroutineStub import org.wfanet.measurement.internal.duchy.RecordOutputBlobPathRequest import org.wfanet.measurement.internal.duchy.config.LiquidLegionsV2SetupConfig.RoleInComputation -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage @RunWith(JUnit4::class) class AsyncComputationControlServiceTest { diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computationcontrol/LiquidLegionsSketchAggregationV2ContextTest.kt b/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computationcontrol/LiquidLegionsSketchAggregationV2ContextTest.kt index 824b6df6d..539893c50 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computationcontrol/LiquidLegionsSketchAggregationV2ContextTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computationcontrol/LiquidLegionsSketchAggregationV2ContextTest.kt @@ -28,7 +28,7 @@ import org.wfanet.measurement.internal.duchy.AdvanceComputationRequest import org.wfanet.measurement.internal.duchy.ComputationDetails import org.wfanet.measurement.internal.duchy.ComputationStage import org.wfanet.measurement.internal.duchy.ComputationToken -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage @RunWith(JUnit4::class) class LiquidLegionsSketchAggregationV2ContextTest { diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computationstats/ComputationStatsServiceTest.kt b/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computationstats/ComputationStatsServiceTest.kt index 08666b43c..e4e011d68 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computationstats/ComputationStatsServiceTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/duchy/service/internal/computationstats/ComputationStatsServiceTest.kt @@ -26,7 +26,7 @@ import org.junit.runners.JUnit4 import org.wfanet.measurement.duchy.db.computation.testing.FakeComputationsDatabase import org.wfanet.measurement.internal.duchy.CreateComputationStatRequest import org.wfanet.measurement.internal.duchy.CreateComputationStatResponse -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2.Stage +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2.Stage @RunWith(JUnit4::class) class ComputationStatsServiceTest { @@ -39,8 +39,7 @@ class ComputationStatsServiceTest { CreateComputationStatRequest.newBuilder() .apply { localComputationId = 1 - computationStageBuilder.liquidLegionsSketchAggregationV2 = - Stage.CONFIRM_REQUISITIONS_PHASE + computationStageBuilder.liquidLegionsSketchAggregationV2 = Stage.CONFIRMATION_PHASE attempt = 1 metricValue = 1234 } @@ -56,8 +55,7 @@ class ComputationStatsServiceTest { CreateComputationStatRequest.newBuilder() .apply { localComputationId = 1 - computationStageBuilder.liquidLegionsSketchAggregationV2 = - Stage.CONFIRM_REQUISITIONS_PHASE + computationStageBuilder.liquidLegionsSketchAggregationV2 = Stage.CONFIRMATION_PHASE attempt = 1 metricName = "crypto_cpu_time_millis" metricValue = 1234 diff --git a/src/test/kotlin/org/wfanet/measurement/duchy/service/system/v1alpha/ComputationControlServiceTest.kt b/src/test/kotlin/org/wfanet/measurement/duchy/service/system/v1alpha/ComputationControlServiceTest.kt index 91dcaea8a..34fe40f86 100644 --- a/src/test/kotlin/org/wfanet/measurement/duchy/service/system/v1alpha/ComputationControlServiceTest.kt +++ b/src/test/kotlin/org/wfanet/measurement/duchy/service/system/v1alpha/ComputationControlServiceTest.kt @@ -46,7 +46,7 @@ import org.wfanet.measurement.internal.duchy.AdvanceComputationRequest as AsyncA import org.wfanet.measurement.internal.duchy.AdvanceComputationResponse as AsyncAdvanceComputationResponse import org.wfanet.measurement.internal.duchy.AsyncComputationControlGrpcKt.AsyncComputationControlCoroutineImplBase import org.wfanet.measurement.internal.duchy.AsyncComputationControlGrpcKt.AsyncComputationControlCoroutineStub -import org.wfanet.measurement.protocol.LiquidLegionsSketchAggregationV2 +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsSketchAggregationV2 import org.wfanet.measurement.storage.StorageClient import org.wfanet.measurement.storage.filesystem.FileSystemStorageClient import org.wfanet.measurement.system.v1alpha.AdvanceComputationRequest diff --git a/src/test/kotlin/org/wfanet/measurement/integration/common/InProcessDuchy.kt b/src/test/kotlin/org/wfanet/measurement/integration/common/InProcessDuchy.kt index 259e89eb5..1f92d57a9 100644 --- a/src/test/kotlin/org/wfanet/measurement/integration/common/InProcessDuchy.kt +++ b/src/test/kotlin/org/wfanet/measurement/integration/common/InProcessDuchy.kt @@ -57,7 +57,7 @@ import org.wfanet.measurement.internal.duchy.ComputationsGrpcKt.ComputationsCoro import org.wfanet.measurement.internal.duchy.MetricValuesGrpcKt.MetricValuesCoroutineStub import org.wfanet.measurement.internal.duchy.config.LiquidLegionsV2SetupConfig import org.wfanet.measurement.internal.duchy.config.ProtocolsSetupConfig -import org.wfanet.measurement.protocol.LiquidLegionsV2NoiseConfig +import org.wfanet.measurement.internal.duchy.protocol.LiquidLegionsV2NoiseConfig import org.wfanet.measurement.storage.StorageClient import org.wfanet.measurement.system.v1alpha.ComputationControlGrpcKt.ComputationControlCoroutineStub import org.wfanet.measurement.system.v1alpha.GlobalComputationsGrpcKt.GlobalComputationsCoroutineStub