Browse Source

testing some changes

Stan Gurtler 2 years ago
parent
commit
7190a4eef5

+ 2 - 0
prsona/cfg/default/commands.cfg

@@ -1,7 +1,9 @@
 V 5
 E
+R 1
 V 5
 E
+R 1
 V 5
 E
 R 1

+ 32 - 2
prsona/src/networkClient.cpp

@@ -70,6 +70,8 @@ void make_vote(
     std::uniform_int_distribution<int> numVoteDistribution(0, numClients);
     size_t numVotes = numVoteDistribution(rng);
     std::vector<size_t> bandwidthData(2);
+    bandwidthData[0] = 0;
+    bandwidthData[1] = 0;
 
     // Make the correct number of new votes, but shuffle where they go
     std::vector<Scalar> votes;
@@ -138,7 +140,12 @@ bool make_reputation_proof(
     std::mutex& usageMtx,
     const std::string& usageFilename)
 {
-    std::vector<size_t> bandwidthData(2);
+    std::vector<double> timingData(2);
+    std::vector<size_t> bandwidthData(2), bandwidthDataMidA, bandwidthDataMidB, bandwidthDataMidC;
+    bandwidthData[0] = 0;
+    bandwidthData[1] = 0;
+
+    std::string extraOutput = outputFilename + ".extra";
 
     std::vector<size_t> bandwidthDataBefore = get_server_log_data(civetServer.getContext());
     std::chrono::high_resolution_clock::time_point wallTimeBefore = std::chrono::high_resolution_clock::now();
@@ -148,6 +155,13 @@ bool make_reputation_proof(
     std::vector<Proof> generatorProof;
     Twistpoint freshGenerator = get_generator(rng, serverIPs, serverPorts, true, generatorProof, bandwidthData);
 
+    // EXTRA
+    bandwidthDataMidA = get_server_log_data(civetServer.getContext());
+    bandwidthDataMidB[0] += bandwidthDataMidA[0] - bandwidthDataBefore[0];
+    bandwidthDataMidB[1] += bandwidthDataMidA[1] - bandwidthDataBefore[1];
+
+    write_log_data(outputMtx, extraOutput, timingData, bandwidthDataMidB);
+
     // Load fresh generator into client object
     prsonaClient->receive_fresh_generator(generatorProof, freshGenerator);
 
@@ -158,6 +172,13 @@ bool make_reputation_proof(
     std::vector<Proof> encryptedScoreProof;
     EGCiphertext encryptedScore = get_server_committed_val<EGCiphertext>(rng, serverIPs, serverPorts, REQUEST_CLIENT_TALLY_URI, REQUEST_CLIENT_TALLY_COMMITMENT_URI, encryptedScoreProof, shortTermPublicKey, bandwidthData);
 
+    // EXTRA
+    bandwidthDataMidC = get_server_log_data(civetServer.getContext());
+    bandwidthDataMidB[0] += bandwidthDataMidC[0] - bandwidthDataMidA[0];
+    bandwidthDataMidB[1] += bandwidthDataMidC[1] - bandwidthDataMidA[1];
+
+    write_log_data(outputMtx, extraOutput, timingData, bandwidthDataMidB);
+
     // Load this current encrypted score into client object
     prsonaClient->receive_vote_tally(encryptedScoreProof, encryptedScore);
 
@@ -173,11 +194,18 @@ bool make_reputation_proof(
     // Send that proof to a chosen client (and set up a file to receive whether or not the client accepted the proof)
     char *responseFile = send_item(rng, target, targetPort, VERIFY_REPUTATION_PROOF_URI, data, true, bandwidthData);
 
+    // EXTRA
+    bandwidthDataMidA = get_server_log_data(civetServer.getContext());
+    bandwidthDataMidB[0] += bandwidthDataMidA[0] - bandwidthDataMidC[0];
+    bandwidthDataMidB[1] += bandwidthDataMidA[1] - bandwidthDataMidC[1];
+
+    write_log_data(outputMtx, extraOutput, timingData, bandwidthData);
+    write_log_data(outputMtx, extraOutput, timingData, bandwidthDataMidB);
+
     clock_t cpuTimeAfter = clock();
     std::chrono::high_resolution_clock::time_point wallTimeAfter = std::chrono::high_resolution_clock::now();
     std::vector<size_t> bandwidthDataAfter = get_server_log_data(civetServer.getContext());
 
-    std::vector<double> timingData(2);
     timingData[0] = std::chrono::duration_cast<std::chrono::duration<double>>(wallTimeAfter - wallTimeBefore).count();
     timingData[1] = ((double)(cpuTimeAfter - cpuTimeBefore)) / CLOCKS_PER_SEC;
 
@@ -1056,6 +1084,8 @@ void PrsonaClientWebSocketHandler::verify_reputation_proof(
     Twistpoint shortTermPublicKey;
     Scalar threshold;
     std::vector<size_t> bandwidthData(2);
+    bandwidthData[0] = 0;
+    bandwidthData[1] = 0;
 
     // Un-serialize the reputation proof
     std::ifstream file(filename);

+ 2 - 15
prsona/src/networkOrchestrator.cpp

@@ -31,7 +31,7 @@ void start_remote_actor(
     const char* sshFile = "/usr/bin/ssh";
     const char* serverFile = "bin/server";
     const char* clientFile = "bin/client";
-    const char* calledFile = (target != "tick0" && !target.empty() ? sshFile : (server ? serverFile : clientFile));
+    const char* calledFile = (target != "self" && !target.empty() ? sshFile : (server ? serverFile : clientFile));
 
     char *argv[6];
 
@@ -65,21 +65,8 @@ void start_remote_actor(
     else
         strncpy(maliciousBuffer, "F", 2);
 
-    if (target != "tick0" && !target.empty())
+    if (target != "self" && !target.empty())
     {
-        fullArgString = "~/prsona/prsona/scripts/startup.sh ";
-        fullArgString += (server ? "server" : "client");
-        fullArgString += " ";
-        fullArgString += id;
-        fullArgString += " ";
-        fullArgString += output;
-        fullArgString += " ";
-        fullArgString += lambdaStream.str();
-        fullArgString += " ";
-        fullArgString += (maliciousServers ? "T" : "F");
-
-        strncpy(fullArgBuffer, fullArgString.c_str(), 256);
-
         argv[1] = flagBuffer;
         argv[2] = targetBuffer;
         argv[3] = fullArgBuffer;

+ 1 - 0
prsona/src/orchestratorMain.cpp

@@ -77,6 +77,7 @@ int main(int argc, char* argv[])
     targeter["129.97.119.208"] = "tick0";
     targeter["129.97.119.209"] = "tick1";
     targeter["129.97.119.215"] = "tock";
+    targeter["127.0.0.1"] = "self";
 
     string configDir = "cfg/" + output;