From ae03f6e69507d949d3afa0058097685026e346e8 Mon Sep 17 00:00:00 2001 From: Carlos Segarra Date: Tue, 15 Feb 2022 09:28:48 +0000 Subject: [PATCH 1/4] util: remove sgx-related message fields --- src/util/func.cpp | 4 ---- src/util/json.cpp | 43 ------------------------------------------- 2 files changed, 47 deletions(-) diff --git a/src/util/func.cpp b/src/util/func.cpp index 67036cbb6..9dbb61869 100644 --- a/src/util/func.cpp +++ b/src/util/func.cpp @@ -28,10 +28,6 @@ std::string funcToString(const faabric::Message& msg, bool includeId) str += ":" + std::to_string(msg.id()); } - if (msg.issgx()) { - str += ":sgx"; - } - return str; } diff --git a/src/util/json.cpp b/src/util/json.cpp index 2aa318133..6e97382e6 100644 --- a/src/util/json.cpp +++ b/src/util/json.cpp @@ -151,40 +151,6 @@ std::string messageToJson(const faabric::Message& msg) a); } - if (msg.issgx()) { - d.AddMember("sgx", msg.issgx(), a); - } - - if (!msg.sgxsid().empty()) { - d.AddMember( - "sgxsid", Value(msg.sgxsid().c_str(), msg.sgxsid().size()).Move(), a); - } - - if (!msg.sgxnonce().empty()) { - d.AddMember("sgxnonce", - Value(msg.sgxnonce().c_str(), msg.sgxnonce().size()).Move(), - a); - } - - if (!msg.sgxtag().empty()) { - d.AddMember( - "sgxtag", Value(msg.sgxtag().c_str(), msg.sgxtag().size()).Move(), a); - } - - if (!msg.sgxpolicy().empty()) { - d.AddMember( - "sgxpolicy", - Value(msg.sgxpolicy().c_str(), msg.sgxpolicy().size()).Move(), - a); - } - - if (!msg.sgxresult().empty()) { - d.AddMember( - "sgxresult", - Value(msg.sgxresult().c_str(), msg.sgxresult().size()).Move(), - a); - } - if (msg.recordexecgraph()) { d.AddMember("record_exec_graph", msg.recordexecgraph(), a); @@ -251,8 +217,6 @@ std::string getJsonOutput(const faabric::Message& msg) Document d; d.SetObject(); Document::AllocatorType& a = d.GetAllocator(); - std::string result_ = cppcodec::base64_rfc4648::encode(msg.sgxresult()); - d.AddMember("result", Value(result_.c_str(), result_.size(), a).Move(), a); d.AddMember( "output_data", Value(msg.outputdata().c_str(), msg.outputdata().size(), a).Move(), @@ -421,13 +385,6 @@ faabric::Message jsonToMessage(const std::string& jsonIn) msg.set_cmdline(getStringFromJson(d, "cmdline", "")); - msg.set_issgx(getBoolFromJson(d, "sgx", false)); - msg.set_sgxsid(getStringFromJson(d, "sgxsid", "")); - msg.set_sgxnonce(getStringFromJson(d, "sgxnonce", "")); - msg.set_sgxtag(getStringFromJson(d, "sgxtag", "")); - msg.set_sgxpolicy(getStringFromJson(d, "sgxpolicy", "")); - msg.set_sgxresult(getStringFromJson(d, "sgxresult", "")); - msg.set_recordexecgraph(getBoolFromJson(d, "record_exec_graph", false)); // By default, clear the map From 4ac67770273d9a7eb8495ab14fce267693de5ce7 Mon Sep 17 00:00:00 2001 From: Carlos Segarra Date: Tue, 15 Feb 2022 09:31:05 +0000 Subject: [PATCH 2/4] tests: remove tests to sgx message fields and encoded output --- tests/test/util/test_json.cpp | 19 ------------------- tests/utils/message_utils.cpp | 7 ------- 2 files changed, 26 deletions(-) diff --git a/tests/test/util/test_json.cpp b/tests/test/util/test_json.cpp index 2fefc6ed3..faecc3292 100644 --- a/tests/test/util/test_json.cpp +++ b/tests/test/util/test_json.cpp @@ -34,13 +34,6 @@ TEST_CASE("Test message to JSON round trip", "[util]") msg.set_cmdline("some cmdline"); - msg.set_issgx(true); - msg.set_sgxsid("test sid string"); - msg.set_sgxnonce("test nonce string"); - msg.set_sgxtag("test tag string"); - msg.set_sgxpolicy("test policy string"); - msg.set_sgxresult("test result string"); - msg.set_recordexecgraph(true); auto& map = *msg.mutable_execgraphdetails(); map["foo"] = "bar"; @@ -93,16 +86,4 @@ TEST_CASE("Test with raw string literals", "[util]") REQUIRE(msg.user() == "foo"); REQUIRE(msg.function() == "bar"); } - -TEST_CASE("Test base64-encoded result", "[util]") -{ - faabric::Message msg; - msg.set_sgxresult("test tag string"); - msg.set_outputdata("test output string"); - std::string encodedOutput = getJsonOutput(msg); - REQUIRE(getValueFromJsonString("result", encodedOutput) == - "dGVzdCB0YWcgc3RyaW5n"); - REQUIRE(getValueFromJsonString("output_data", encodedOutput) == - "test output string"); -} } diff --git a/tests/utils/message_utils.cpp b/tests/utils/message_utils.cpp index d3189ec18..97500306d 100644 --- a/tests/utils/message_utils.cpp +++ b/tests/utils/message_utils.cpp @@ -41,13 +41,6 @@ void checkMessageEquality(const faabric::Message& msgA, REQUIRE(msgA.cmdline() == msgB.cmdline()); - REQUIRE(msgA.issgx() == msgB.issgx()); - REQUIRE(msgA.sgxsid() == msgB.sgxsid()); - REQUIRE(msgA.sgxnonce() == msgB.sgxnonce()); - REQUIRE(msgA.sgxtag() == msgB.sgxtag()); - REQUIRE(msgA.sgxpolicy() == msgB.sgxpolicy()); - REQUIRE(msgA.sgxresult() == msgB.sgxresult()); - REQUIRE(msgA.recordexecgraph() == msgB.recordexecgraph()); checkMessageMapEquality(msgA.execgraphdetails(), msgB.execgraphdetails()); checkMessageMapEquality(msgA.intexecgraphdetails(), From f26d8c5537e3728e99da743dfb267b53164a6aa5 Mon Sep 17 00:00:00 2001 From: Carlos Segarra Date: Tue, 15 Feb 2022 09:44:59 +0000 Subject: [PATCH 3/4] proto: remove sgx fields from the main message object --- src/proto/faabric.proto | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/proto/faabric.proto b/src/proto/faabric.proto index c366fe7f2..aab9fb279 100644 --- a/src/proto/faabric.proto +++ b/src/proto/faabric.proto @@ -156,25 +156,16 @@ message Message { string cmdline = 34; - // SGX - bool isSgx = 35; - - string sgxSid = 36; - string sgxNonce = 37; - string sgxTag = 38; - bytes sgxPolicy = 39; - bytes sgxResult = 40; - // Exec-graph utils - bool recordExecGraph = 41; - map intExecGraphDetails = 42; - map execGraphDetails = 43; + bool recordExecGraph = 35; + map intExecGraphDetails = 36; + map execGraphDetails = 37; // Function migration - int32 migrationCheckPeriod = 44; + int32 migrationCheckPeriod = 38; // Scheduling - string topologyHint = 45; + string topologyHint = 39; } // --------------------------------------------- From e0afd7be5d749d46d83e7a7e2ce20648ae2f5714 Mon Sep 17 00:00:00 2001 From: Carlos Segarra Date: Tue, 15 Feb 2022 09:45:20 +0000 Subject: [PATCH 4/4] endpoint: remove checks for sgx results --- src/endpoint/FaabricEndpointHandler.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/endpoint/FaabricEndpointHandler.cpp b/src/endpoint/FaabricEndpointHandler.cpp index c711c2d49..8f228fafd 100644 --- a/src/endpoint/FaabricEndpointHandler.cpp +++ b/src/endpoint/FaabricEndpointHandler.cpp @@ -137,13 +137,7 @@ std::pair FaabricEndpointHandler::executeFunction( sch.getFunctionResult(msg.id(), conf.globalMessageTimeout); SPDLOG_DEBUG("Worker thread {} result {}", tid, funcStr); - if (result.sgxresult().empty()) { - return std::make_pair(result.returnvalue(), - result.outputdata() + "\n"); - } - - return std::make_pair(result.returnvalue(), - faabric::util::getJsonOutput(result)); + return std::make_pair(result.returnvalue(), result.outputdata() + "\n"); } catch (faabric::redis::RedisNoResponseException& ex) { return std::make_pair(1, "No response from function\n"); }