Skip to content
This repository was archived by the owner on Jun 20, 2025. It is now read-only.

Commit b880191

Browse files
Caleb Jaegerfacebook-github-bot
authored andcommitted
Move PCF2-Lift Options to a shared location (#2198)
Summary: Pull Request resolved: #2198 This is moving the Lift options out of main so that they can be used in other parts of the code. This is especially important for feature flagging within the cpp code. Reviewed By: ajinkya-ghonge, haochenuw Differential Revision: D44062784 fbshipit-source-id: 46b4dc7fc95f14d24eeed32462569f4c3ffad9fe
1 parent 1a2df6c commit b880191

File tree

10 files changed

+230
-192
lines changed

10 files changed

+230
-192
lines changed

fbpcs/emp_games/lift/calculator/test/CalculatorAppTest.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
constexpr int32_t tsOffset = 10;
2525

2626
DEFINE_bool(is_conversion_lift, true, "is conversion lift");
27-
DEFINE_int32(num_conversions_per_user, 4, "num of conversions per user");
28-
DEFINE_int64(epoch, 1546300800, "epoch");
2927

3028
namespace private_lift {
3129
class CalculatorAppTest : public ::testing::Test {
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
#include "fbpcs/emp_games/lift/common/CommonLiftOptions.h"
9+
#include <gflags/gflags.h>
10+
11+
DEFINE_bool(
12+
compute_publisher_breakdowns,
13+
true,
14+
"To enable or disable computing publisher breakdown for result validation");
15+
DEFINE_bool(
16+
log_cost,
17+
false,
18+
"Log cost info into cloud which will be used for dashboard");
19+
DEFINE_bool(
20+
use_tls,
21+
false,
22+
"Whether to use TLS when communicating with other parties.");
23+
DEFINE_bool(
24+
use_xor_encryption,
25+
true,
26+
"Reveal output with XOR secret shares instead of in the clear to both parties");
27+
DEFINE_int32(concurrency, 1, "max number of games that will run concurrently");
28+
DEFINE_int32(
29+
file_start_index,
30+
0,
31+
"First file that will be read with base path");
32+
DEFINE_int32(
33+
num_conversions_per_user,
34+
4,
35+
"Cap and pad to this many conversions per user");
36+
DEFINE_int32(num_files, 0, "Number of files that should be read");
37+
DEFINE_int32(party, 1, "1 = publisher, 2 = partner");
38+
DEFINE_int32(
39+
port,
40+
10000,
41+
"Network port for establishing connection to other player");
42+
DEFINE_int64(
43+
epoch,
44+
1546300800,
45+
"Unixtime of 2019-01-01. Used as our 'new epoch' for timestamps");
46+
DEFINE_string(
47+
ca_cert_path,
48+
"",
49+
"Relative file path where root CA cert is stored. It will be prefixed with $HOME.");
50+
DEFINE_string(
51+
input_base_path,
52+
"",
53+
"Local or s3 base path for the sharded input files");
54+
DEFINE_string(log_cost_s3_bucket, "", "s3 bucket name");
55+
DEFINE_string(
56+
log_cost_s3_region,
57+
".s3.us-west-2.amazonaws.com/",
58+
"s3 region name");
59+
DEFINE_string(
60+
pc_feature_flags,
61+
"",
62+
"A String of PC Feature Flags passing from PCS, separated by comma");
63+
DEFINE_string(
64+
private_key_path,
65+
"",
66+
"Relative file path where private key is stored. It will be prefixed with $HOME.");
67+
DEFINE_string(
68+
run_name,
69+
"",
70+
"A user given run name that will be used in s3 filename");
71+
DEFINE_string(
72+
server_cert_path,
73+
"",
74+
"Relative file path where server cert is stored. It will be prefixed with $HOME.");
75+
DEFINE_string(server_ip, "127.0.0.1", "Server's IP Address");
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
#pragma once
9+
10+
#include <gflags/gflags_declare.h>
11+
12+
DECLARE_bool(compute_publisher_breakdowns);
13+
DECLARE_bool(log_cost);
14+
DECLARE_bool(use_tls);
15+
DECLARE_bool(use_xor_encryption);
16+
DECLARE_int32(concurrency);
17+
DECLARE_int32(file_start_index);
18+
DECLARE_int32(num_conversions_per_user);
19+
DECLARE_int32(num_files);
20+
DECLARE_int32(party);
21+
DECLARE_int32(port);
22+
DECLARE_int64(epoch);
23+
DECLARE_string(ca_cert_path);
24+
DECLARE_string(input_base_path);
25+
DECLARE_string(log_cost_s3_bucket);
26+
DECLARE_string(log_cost_s3_region);
27+
DECLARE_string(pc_feature_flags);
28+
DECLARE_string(private_key_path);
29+
DECLARE_string(run_name);
30+
DECLARE_string(server_cert_path);
31+
DECLARE_string(server_ip);

fbpcs/emp_games/lift/metadata_compaction/MainUtil.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
#pragma once
99

1010
#include <memory>
11+
#include <vector>
1112
#include "folly/Format.h"
1213

1314
#include "fbpcf/engine/communication/SocketPartyCommunicationAgentFactory.h"
1415
#include "fbpcs/emp_games/lift/metadata_compaction/MetadataCompactorApp.h"
1516
#include "fbpcs/emp_games/lift/metadata_compaction/MetadataCompactorGame.h"
1617
#include "fbpcs/emp_games/lift/metadata_compaction/MetadataCompactorGameFactory.h"
17-
1818
namespace private_lift {
1919

2020
struct LiftMetadataCompactionFilePaths {

fbpcs/emp_games/lift/metadata_compaction/MetadataCompactionOptions.cpp

Lines changed: 51 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -6,93 +6,89 @@
66
*/
77

88
#include "fbpcs/emp_games/lift/metadata_compaction/MetadataCompactionOptions.h"
9+
#include <gflags/gflags.h>
10+
#include "fbpcs/emp_games/lift/common/CommonLiftOptions.h"
911

10-
DEFINE_int32(party, 1, "1 = publisher, 2 = partner");
11-
DEFINE_bool(
12-
use_xor_encryption,
13-
true,
14-
"Reveal output with XOR secret shares instead of in the clear to both parties");
15-
DEFINE_string(server_ip, "127.0.0.1", "Server's IP Address");
16-
DEFINE_int32(
17-
port,
18-
10000,
19-
"Network port for establishing connection to other player");
20-
21-
// Lift settings
2212
DEFINE_string(input_path, "", "Input file to run lift metadata compaction");
13+
DEFINE_string(
14+
output_global_params_base_path,
15+
"",
16+
"Local or s3 base path where output global param files are written to");
2317
DEFINE_string(
2418
output_global_params_path,
2519
"",
2620
"Output file to write global params from input data.");
21+
DEFINE_string(
22+
output_secret_shares_base_path,
23+
"",
24+
"Local or s3 base path where output secret share files are written to");
2725
DEFINE_string(
2826
output_secret_shares_path,
2927
"",
3028
"Output file to write compacted metadata secret share results.");
29+
// Common lift options
30+
DEFINE_bool(
31+
compute_publisher_breakdowns,
32+
true,
33+
"To enable or disable computing publisher breakdown for result validation");
34+
DEFINE_bool(
35+
log_cost,
36+
false,
37+
"Log cost info into cloud which will be used for dashboard");
38+
DEFINE_bool(
39+
use_tls,
40+
false,
41+
"Whether to use TLS when communicating with other parties.");
42+
DEFINE_bool(
43+
use_xor_encryption,
44+
true,
45+
"Reveal output with XOR secret shares instead of in the clear to both parties");
46+
DEFINE_int32(concurrency, 1, "max number of games that will run concurrently");
3147
DEFINE_int32(
3248
file_start_index,
3349
0,
3450
"First file that will be read with base path");
51+
DEFINE_int32(
52+
num_conversions_per_user,
53+
4,
54+
"Cap and pad to this many conversions per user");
3555
DEFINE_int32(num_files, 0, "Number of files that should be read");
36-
DEFINE_string(
37-
input_base_path,
38-
"",
39-
"Local or s3 base path for the sharded input files");
40-
DEFINE_string(
41-
output_global_params_base_path,
42-
"",
43-
"Local or s3 base path where output global param files are written to");
44-
DEFINE_string(
45-
output_secret_shares_base_path,
46-
"",
47-
"Local or s3 base path where output secret share files are written to");
48-
DEFINE_int32(concurrency, 1, "max number of games that will run concurrently");
56+
DEFINE_int32(party, 1, "1 = publisher, 2 = partner");
4957
DEFINE_int32(
58+
port,
59+
10000,
60+
"Network port for establishing connection to other player");
61+
DEFINE_int64(
5062
epoch,
5163
1546300800,
5264
"Unixtime of 2019-01-01. Used as our 'new epoch' for timestamps");
53-
DEFINE_int32(
54-
num_conversions_per_user,
55-
4,
56-
"Cap and pad to this many conversions per user");
57-
DEFINE_bool(
58-
compute_publisher_breakdowns,
59-
true,
60-
"To enable or disable computing publisher breakdown for result validation");
61-
62-
// TLS Settings
63-
DEFINE_bool(
64-
use_tls,
65-
false,
66-
"Whether to use TLS when communicating with other parties.");
6765
DEFINE_string(
6866
ca_cert_path,
6967
"",
7068
"Relative file path where root CA cert is stored. It will be prefixed with $HOME.");
7169
DEFINE_string(
72-
server_cert_path,
70+
input_base_path,
7371
"",
74-
"Relative file path where server cert is stored. It will be prefixed with $HOME.");
72+
"Local or s3 base path for the sharded input files");
73+
DEFINE_string(log_cost_s3_bucket, "", "s3 bucket name");
74+
DEFINE_string(
75+
log_cost_s3_region,
76+
".s3.us-west-2.amazonaws.com/",
77+
"s3 region name");
78+
DEFINE_string(
79+
pc_feature_flags,
80+
"",
81+
"A String of PC Feature Flags passing from PCS, separated by comma");
7582
DEFINE_string(
7683
private_key_path,
7784
"",
7885
"Relative file path where private key is stored. It will be prefixed with $HOME.");
79-
80-
// Logging flags
8186
DEFINE_string(
8287
run_name,
8388
"",
8489
"A user given run name that will be used in s3 filename");
85-
DEFINE_bool(
86-
log_cost,
87-
false,
88-
"Log cost info into cloud which will be used for dashboard");
89-
DEFINE_string(log_cost_s3_bucket, "", "s3 bucket name");
90-
DEFINE_string(
91-
log_cost_s3_region,
92-
".s3.us-west-2.amazonaws.com/",
93-
"s3 region name");
94-
9590
DEFINE_string(
96-
pc_feature_flags,
91+
server_cert_path,
9792
"",
98-
"A String of PC Feature Flags passing from PCS, separated by comma");
93+
"Relative file path where server cert is stored. It will be prefixed with $HOME.");
94+
DEFINE_string(server_ip, "127.0.0.1", "Server's IP Address");

fbpcs/emp_games/lift/metadata_compaction/MetadataCompactionOptions.h

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,9 @@
99

1010
#include <gflags/gflags.h>
1111

12-
// MPC settings
13-
DECLARE_int32(party);
14-
DECLARE_bool(use_xor_encryption);
15-
DECLARE_string(server_ip);
16-
DECLARE_int32(port);
17-
1812
// Lift settings
1913
DECLARE_string(input_path);
20-
DECLARE_string(output_global_params_path);
21-
DECLARE_string(output_secret_shares_path);
22-
DECLARE_int32(file_start_index);
23-
DECLARE_int32(num_files);
24-
DECLARE_string(input_base_path);
2514
DECLARE_string(output_global_params_base_path);
15+
DECLARE_string(output_global_params_path);
2616
DECLARE_string(output_secret_shares_base_path);
27-
DECLARE_int32(concurrency);
28-
DECLARE_int32(epoch);
29-
DECLARE_int32(num_conversions_per_user);
30-
DECLARE_bool(compute_publisher_breakdowns);
31-
32-
// TLS Settings
33-
DECLARE_bool(use_tls);
34-
DECLARE_string(ca_cert_path);
35-
DECLARE_string(server_cert_path);
36-
DECLARE_string(private_key_path);
37-
38-
// Logging flags
39-
DECLARE_string(run_name);
40-
DECLARE_bool(log_cost);
41-
DECLARE_string(log_cost_s3_bucket);
42-
DECLARE_string(log_cost_s3_region);
43-
44-
DECLARE_string(pc_feature_flags);
17+
DECLARE_string(output_secret_shares_path);

fbpcs/emp_games/lift/metadata_compaction/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
#include "fbpcf/aws/AwsSdk.h"
1414
#include "fbpcs/performance_tools/CostEstimation.h"
1515

16+
#include <gflags/gflags.h>
1617
#include "fbpcs/emp_games/common/Constants.h"
1718
#include "fbpcs/emp_games/common/Util.h"
19+
#include "fbpcs/emp_games/lift/common/CommonLiftOptions.h"
1820
#include "fbpcs/emp_games/lift/metadata_compaction/MainUtil.h"
1921
#include "fbpcs/emp_games/lift/metadata_compaction/MetadataCompactionOptions.h"
2022

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
#include "fbpcs/emp_games/lift/pcf2_calculator/LiftOptions.h"
9+
#include <gflags/gflags.h>
10+
11+
DEFINE_bool(
12+
is_conversion_lift,
13+
true,
14+
"Use conversion_lift logic (as opposed to converter_lift logic)");
15+
DEFINE_string(
16+
input_directory,
17+
"",
18+
"Data directory where input files are located");
19+
DEFINE_string(
20+
input_expanded_key_path,
21+
"out.csv_expanded_key_0",
22+
"Input file name of the expanded key for UDP decryption. Used when decoupled UDP is enabled.");
23+
DEFINE_string(
24+
input_filenames,
25+
"in.csv_0[,in.csv_1,in.csv_2,...]",
26+
"List of input file names that should be parsed (should have a header)");
27+
DEFINE_string(
28+
input_global_params_path,
29+
"out.csv_global_params_0",
30+
"Input file name of global parameter setup. Used when reading inputs in secret share format rather than plaintext.");
31+
DEFINE_string(
32+
output_base_path,
33+
"",
34+
"Local or s3 base path where output files are written to");
35+
DEFINE_string(
36+
output_directory,
37+
"",
38+
"Local or s3 path where output files are written to");
39+
DEFINE_string(
40+
output_filenames,
41+
"out.csv_0[,out.csv_1,out.csv_2,...]",
42+
"List of output file names that correspond to input filenames (positionally)");
43+
DEFINE_string(
44+
run_id,
45+
"",
46+
"A run_id used to identify all the logs in a PL run.");
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
#pragma once
9+
10+
#include <gflags/gflags_declare.h>
11+
#include "fbpcs/emp_games/lift/common/CommonLiftOptions.h"
12+
13+
DECLARE_bool(is_conversion_lift);
14+
DECLARE_string(input_directory);
15+
DECLARE_string(input_expanded_key_path);
16+
DECLARE_string(input_filenames);
17+
DECLARE_string(input_global_params_path);
18+
DECLARE_string(output_base_path);
19+
DECLARE_string(output_directory);
20+
DECLARE_string(output_filenames);
21+
DECLARE_string(run_id);

0 commit comments

Comments
 (0)