Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/v9.2] Restart the scilla process at every vacuous epoch #3758

Merged
merged 1 commit into from Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/libDirectoryService/FinalBlockPostProcessing.cpp
Expand Up @@ -34,6 +34,7 @@
#include "libUtils/DataConversion.h"
#include "libUtils/DetachedFunction.h"
#include "libUtils/Logger.h"
#include "libScilla/ScillaClient.h"

using namespace std;
using namespace boost::multiprecision;
Expand Down Expand Up @@ -220,6 +221,9 @@ void DirectoryService::ProcessFinalBlockConsensusWhenDone() {
}

if (isVacuousEpoch) {
// Restart scilla client after every vacuous epoch
ScillaClient::GetInstance().RestartScillaClient();

auto writeStateToDisk = [this]() -> void {
if (!AccountStore::GetInstance().MoveUpdatesToDisk(
m_mediator.m_dsBlockChain.GetLastBlock()
Expand Down
15 changes: 15 additions & 0 deletions src/libScilla/ScillaClient.cpp
Expand Up @@ -126,7 +126,22 @@ bool ScillaClient::OpenServer(uint32_t version) {
return true;
}

void ScillaClient::RestartScillaClient() {
LOG_MARKER();
if (ENABLE_SCILLA_MULTI_VERSION == true) {
LOG_GENERAL(INFO, "ENABLE_SCILLA_MULTI_VERSION is true");
for (const auto& entry : m_clients) {
LOG_GENERAL(INFO, "entry.first = " << entry.first);
CheckClient(entry.first, true);
}
} else {
LOG_GENERAL(INFO, "ENABLE_SCILLA_MULTI_VERSION is false");
CheckClient(0, true);
}
}

bool ScillaClient::CheckClient(uint32_t version, bool enforce) {
LOG_GENERAL(INFO, "CheckClient = " << version << " enforce = " << enforce);
std::lock_guard<std::mutex> g(m_mutexMain);

if (m_clients.find(version) != m_clients.end() && !enforce) {
Expand Down
2 changes: 2 additions & 0 deletions src/libScilla/ScillaClient.h
Expand Up @@ -44,6 +44,8 @@ class ScillaClient {

bool CheckClient(uint32_t version, bool enforce = false);

void RestartScillaClient();

void Init();

bool CallChecker(uint32_t version, const Json::Value& _json,
Expand Down