From 5732db1ebf12f07a9e840dfcdddb2d5ebe39829c Mon Sep 17 00:00:00 2001 From: BrianWu Date: Mon, 15 Apr 2024 18:14:18 +0800 Subject: [PATCH] Need to check the WAITING_STATUS when deal with deleted file. The current logic would have the following bug: 1. Upload work report stuck for a long time (>1 min) due to network instable 2. A call to /storage/delete is invoked to delete a CID which is in the work report being uploaded in #1. 3. Ecall_main_loop is run and then the Workload::deal_deleted_file would be called, here the CID be deleted in the above #2 step would be erased permanently. 4. Work report upload return back. Since the CID has been deleted in #3 permanently, so this CID would NOT be able to include in the next work report as the deleted_files, then the File size check would fail in Crust Mainnet, resulted in the E10003-FileTransitionError seen in sworker side. --- src/enclave/workload/Workload.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/enclave/workload/Workload.cpp b/src/enclave/workload/Workload.cpp index 68677312..046c51dd 100644 --- a/src/enclave/workload/Workload.cpp +++ b/src/enclave/workload/Workload.cpp @@ -983,7 +983,7 @@ void Workload::deal_deleted_file() { std::string status = this->sealed_files[pos][FILE_STATUS].ToString(); if ((status[CURRENT_STATUS] == FILE_STATUS_DELETED && status[ORIGIN_STATUS] == FILE_STATUS_DELETED) - || (status[CURRENT_STATUS] == FILE_STATUS_DELETED && status[ORIGIN_STATUS] == FILE_STATUS_UNVERIFIED) + || (status[CURRENT_STATUS] == FILE_STATUS_DELETED && status[ORIGIN_STATUS] == FILE_STATUS_UNVERIFIED && status[WAITING_STATUS] == FILE_STATUS_UNVERIFIED) || (status[CURRENT_STATUS] == FILE_STATUS_DELETED && status[ORIGIN_STATUS] == FILE_STATUS_LOST)) { this->sealed_files.erase(this->sealed_files.begin() + pos);