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

Commit 4254489

Browse files
Caleb Jaegerfacebook-github-bot
authored andcommitted
Move PCF2-Lift Options to a shared location
Summary: 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. Differential Revision: D44062784 fbshipit-source-id: 5fbd1887ad5273bc3d049c267299f56efb67d683
1 parent 9b24415 commit 4254489

File tree

8 files changed

+177
-211
lines changed

8 files changed

+177
-211
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: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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 <gflags/gflags.h>
9+
10+
DEFINE_bool(
11+
compute_publisher_breakdowns,
12+
true,
13+
"To enable or disable computing publisher breakdown for result validation");
14+
DEFINE_bool(
15+
log_cost,
16+
false,
17+
"Log cost info into cloud which will be used for dashboard");
18+
DEFINE_bool(
19+
use_tls,
20+
false,
21+
"Whether to use TLS when communicating with other parties.");
22+
DEFINE_bool(
23+
use_xor_encryption,
24+
true,
25+
"Reveal output with XOR secret shares instead of in the clear to both parties");
26+
DEFINE_int32(concurrency, 1, "max number of games that will run concurrently");
27+
DEFINE_int32(
28+
file_start_index,
29+
0,
30+
"First file that will be read with base path");
31+
DEFINE_int32(
32+
num_conversions_per_user,
33+
4,
34+
"Cap and pad to this many conversions per user");
35+
DEFINE_int32(num_files, 0, "Number of files that should be read");
36+
DEFINE_int32(party, 1, "1 = publisher, 2 = partner");
37+
DEFINE_int32(
38+
port,
39+
10000,
40+
"Network port for establishing connection to other player");
41+
DEFINE_int64(
42+
epoch,
43+
1546300800,
44+
"Unixtime of 2019-01-01. Used as our 'new epoch' for timestamps");
45+
DEFINE_string(
46+
ca_cert_path,
47+
"",
48+
"Relative file path where root CA cert is stored. It will be prefixed with $HOME.");
49+
DEFINE_string(
50+
input_base_path,
51+
"",
52+
"Local or s3 base path for the sharded input files");
53+
DEFINE_string(log_cost_s3_bucket, "", "s3 bucket name");
54+
DEFINE_string(
55+
log_cost_s3_region,
56+
".s3.us-west-2.amazonaws.com/",
57+
"s3 region name");
58+
DEFINE_string(
59+
pc_feature_flags,
60+
"",
61+
"A String of PC Feature Flags passing from PCS, separated by comma");
62+
DEFINE_string(
63+
private_key_path,
64+
"",
65+
"Relative file path where private key is stored. It will be prefixed with $HOME.");
66+
DEFINE_string(
67+
run_name,
68+
"",
69+
"A user given run name that will be used in s3 filename");
70+
DEFINE_string(
71+
server_cert_path,
72+
"",
73+
"Relative file path where server cert is stored. It will be prefixed with $HOME.");
74+
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/MetadataCompactionOptions.cpp

Lines changed: 6 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -7,92 +7,20 @@
77

88
#include "fbpcs/emp_games/lift/metadata_compaction/MetadataCompactionOptions.h"
99

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
2210
DEFINE_string(input_path, "", "Input file to run lift metadata compaction");
23-
DEFINE_string(
24-
output_global_params_path,
25-
"",
26-
"Output file to write global params from input data.");
27-
DEFINE_string(
28-
output_secret_shares_path,
29-
"",
30-
"Output file to write compacted metadata secret share results.");
31-
DEFINE_int32(
32-
file_start_index,
33-
0,
34-
"First file that will be read with base path");
35-
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");
4011
DEFINE_string(
4112
output_global_params_base_path,
4213
"",
4314
"Local or s3 base path where output global param files are written to");
4415
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");
49-
DEFINE_int32(
50-
epoch,
51-
1546300800,
52-
"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.");
67-
DEFINE_string(
68-
ca_cert_path,
69-
"",
70-
"Relative file path where root CA cert is stored. It will be prefixed with $HOME.");
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(
76-
private_key_path,
16+
output_global_params_path,
7717
"",
78-
"Relative file path where private key is stored. It will be prefixed with $HOME.");
79-
80-
// Logging flags
18+
"Output file to write global params from input data.");
8119
DEFINE_string(
82-
run_name,
20+
output_secret_shares_base_path,
8321
"",
84-
"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-
22+
"Local or s3 base path where output secret share files are written to");
9523
DEFINE_string(
96-
pc_feature_flags,
24+
output_secret_shares_path,
9725
"",
98-
"A String of PC Feature Flags passing from PCS, separated by comma");
26+
"Output file to write compacted metadata secret share results.");

fbpcs/emp_games/lift/metadata_compaction/MetadataCompactionOptions.h

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,11 @@
88
#pragma once
99

1010
#include <gflags/gflags.h>
11-
12-
// MPC settings
13-
DECLARE_int32(party);
14-
DECLARE_bool(use_xor_encryption);
15-
DECLARE_string(server_ip);
16-
DECLARE_int32(port);
11+
#include "fbpcs/emp_games/lift/common/CommonLiftOptions.h"
1712

1813
// Lift settings
1914
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);
2515
DECLARE_string(output_global_params_base_path);
16+
DECLARE_string(output_global_params_path);
2617
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);
18+
DECLARE_string(output_secret_shares_path);
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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_filenames,
21+
"in.csv_0[,in.csv_1,in.csv_2,...]",
22+
"List of input file names that should be parsed (should have a header)");
23+
DEFINE_string(
24+
input_global_params_path,
25+
"out.csv_global_params_0",
26+
"Input file name of global parameter setup. Used when reading inputs in secret share format rather than plaintext.");
27+
DEFINE_string(
28+
output_base_path,
29+
"",
30+
"Local or s3 base path where output files are written to");
31+
DEFINE_string(
32+
output_directory,
33+
"",
34+
"Local or s3 path where output files are written to");
35+
DEFINE_string(
36+
output_filenames,
37+
"out.csv_0[,out.csv_1,out.csv_2,...]",
38+
"List of output file names that correspond to input filenames (positionally)");
39+
DEFINE_string(
40+
run_id,
41+
"",
42+
"A run_id used to identify all the logs in a PL run.");
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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_filenames);
16+
DECLARE_string(input_global_params_path);
17+
DECLARE_string(output_base_path);
18+
DECLARE_string(output_directory);
19+
DECLARE_string(output_filenames);
20+
DECLARE_string(run_id);

0 commit comments

Comments
 (0)