Skip to content

Commit 5b94dc8

Browse files
committed
Fix error check + output of loading contract states
1 parent 3c77e21 commit 5b94dc8

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/qubic.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5238,7 +5238,6 @@ static void contractProcessorShutdownCallback(EFI_EVENT Event, void* Context)
52385238
static bool loadComputer(CHAR16* directory, bool forceLoadFromFile)
52395239
{
52405240
logToConsole(L"Loading contract files ...");
5241-
setText(message, L"Loaded SC: ");
52425241
for (unsigned int contractIndex = 0; contractIndex < contractCount; contractIndex++)
52435242
{
52445243
if (contractDescriptions[contractIndex].constructionEpoch == system.epoch && !forceLoadFromFile)
@@ -5252,29 +5251,26 @@ static bool loadComputer(CHAR16* directory, bool forceLoadFromFile)
52525251
CONTRACT_FILE_NAME[sizeof(CONTRACT_FILE_NAME) / sizeof(CONTRACT_FILE_NAME[0]) - 7] = (contractIndex % 100) / 10 + L'0';
52535252
CONTRACT_FILE_NAME[sizeof(CONTRACT_FILE_NAME) / sizeof(CONTRACT_FILE_NAME[0]) - 6] = contractIndex % 10 + L'0';
52545253
long long loadedSize = load(CONTRACT_FILE_NAME, contractDescriptions[contractIndex].stateSize, contractStates[contractIndex], directory);
5254+
setText(message, L" -> ");
5255+
appendText(message, CONTRACT_FILE_NAME);
52555256
if (loadedSize != contractDescriptions[contractIndex].stateSize)
52565257
{
52575258
if (system.epoch < contractDescriptions[contractIndex].constructionEpoch && contractDescriptions[contractIndex].stateSize >= sizeof(IPO))
52585259
{
52595260
setMem(contractStates[contractIndex], contractDescriptions[contractIndex].stateSize, 0);
5260-
appendText(message, L"(");
5261-
appendText(message, CONTRACT_FILE_NAME);
5262-
appendText(message, L" not loaded but initialized with zeros for IPO) ");
5261+
appendText(message, L" not loaded but initialized with zeros for IPO");
52635262
}
52645263
else
52655264
{
5265+
appendText(message, L" cannot be read successfully");
5266+
logToConsole(message);
52665267
logStatusToConsole(L"EFI_FILE_PROTOCOL.Read() reads invalid number of bytes", loadedSize, __LINE__);
52675268
return false;
52685269
}
52695270
}
5270-
else
5271-
{
5272-
appendText(message, CONTRACT_FILE_NAME);
5273-
appendText(message, L" ");
5274-
}
5271+
logToConsole(message);
52755272
}
52765273
}
5277-
logToConsole(message);
52785274
return true;
52795275
}
52805276

@@ -5555,7 +5551,8 @@ static bool initialize()
55555551
appendText(message, L".");
55565552
logToConsole(message);
55575553
}
5558-
loadComputer();
5554+
if (!loadComputer())
5555+
return false;
55595556
m256i computerDigest;
55605557
{
55615558
setText(message, L"Computer digest = ");

0 commit comments

Comments
 (0)