Skip to content

Commit

Permalink
Merge pull request #620 from skalenetwork/full_sync
Browse files Browse the repository at this point in the history
#602: Remove exit
  • Loading branch information
kladkogex authored May 5, 2022
2 parents 7246b8a + a3afb32 commit 0fe512f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 31 deletions.
5 changes: 0 additions & 5 deletions SkaleCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,6 @@ static const uint64_t ORACLE_RECEIPTS_MAP_SIZE = 100000;

static const uint64_t ORACLE_FUTURE_JITTER_MS = 500;


static const uint64_t SYNC_NODE_SLEEP_BEFORE_EXIT_MS = 5000;
static const uint64_t SYNC_NODE_EXIT_CODE = 314;


static const uint64_t SGX_REQUEST_TIMEOUT_MS = 10000;


Expand Down
19 changes: 1 addition & 18 deletions catchup/client/CatchupClientAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,20 +238,9 @@ ptr<CommittedBlockList> CatchupClientAgent::readMissingBlocks(
CHECK_STATE(blockList);
}
catch (ExitRequestedException &) { throw; }
catch (InvalidSignatureException &) {
if (getNode()->isSyncOnlyNode()) {
LOG(info, "Sync node cant verify ECDSA sig. Rotation must have occured. Restarting ...");
// rotation must have occured. Sleep for some seconds and then exit
usleep(SYNC_NODE_SLEEP_BEFORE_EXIT_MS * 1000);
exit(SYNC_NODE_EXIT_CODE);
} else {
throw_with_nested(
NetworkProtocolException("Could not parse block list", __CLASS_NAME__));
}
}
catch (...) {
throw_with_nested(
NetworkProtocolException("Could not parse block list", __CLASS_NAME__));
NetworkProtocolException("Could not process block list", __CLASS_NAME__));
}


Expand All @@ -265,14 +254,8 @@ ptr<CommittedBlockList> CatchupClientAgent::readMissingBlocks(
getSchain()->getCryptoManager()->verifyBlockSig(sig, item->getBlockID(),
hash, item->getTimeStamp());
} catch (InvalidSignatureException &) {
if (getNode()->isSyncOnlyNode()) {
LOG(info, "Sync node cant verify BLS sig. Rotation must have occured. Restarting ..."); // rotation must have occured. Sleep for some seconds and then exit
usleep(SYNC_NODE_SLEEP_BEFORE_EXIT_MS * 1000);
exit(SYNC_NODE_EXIT_CODE);
} else {
throw_with_nested(
NetworkProtocolException("Could not verify block BLS sig:", __CLASS_NAME__));
}
}
}

Expand Down
9 changes: 1 addition & 8 deletions docs/fullsync.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,7 @@ is read from SkaleManager and inserted into config.

## Sync node behavior during rotation.

* After rotation, a block BLS signature will not verify,
since it uses the new BLS key.
* This will cause skaled to
exit with error code ```SYNC_NODE_EXIT_CODE = 314```
* This will cause config regeneration, so the new config
will include the new key.
* After that sync node will start with new config.

* Sync admin will detect rotation, regenerate the config and restart skaled with new config



Expand Down

0 comments on commit 0fe512f

Please sign in to comment.