Skip to content

Commit c769f07

Browse files
committed
Merge master [don't auto-bump]
1 parent 98f5f3b commit c769f07

26 files changed

+120
-117
lines changed

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ CONCORD_BFT_ADDITIONAL_RUN_PARAMS+=\
168168
--network host
169169
endif
170170

171+
CONCORD_BFT_ADDITIONAL_CTEST_RUN_PARAMS="--output-on-failure"
172+
FAILED_CASES_FILE=/concord-bft/build/apollogs/latest/failed_cases.txt
173+
PRINT_FAILED_APOLLO_CASES=([ -s ${FAILED_CASES_FILE} ] && echo Failed apollo cases: && cat -n ${FAILED_CASES_FILE} && exit 1)
174+
171175
ifneq (${APOLLO_LOG_STDOUT},)
172176
CONCORD_BFT_ADDITIONAL_RUN_PARAMS+=--env APOLLO_LOG_STDOUT=TRUE
173177
CONCORD_BFT_ADDITIONAL_CTEST_RUN_PARAMS+=-V
@@ -189,8 +193,7 @@ BASIC_RUN_PARAMS?=-it --init --rm --privileged=true \
189193
--name="${CONCORD_BFT_DOCKER_CONTAINER}" \
190194
--workdir=${CONCORD_BFT_TARGET_SOURCE_PATH} \
191195
--mount type=bind,source=${CURDIR},target=${CONCORD_BFT_TARGET_SOURCE_PATH}${CONCORD_BFT_CONTAINER_MOUNT_CONSISTENCY} \
192-
${CONCORD_BFT_ADDITIONAL_RUN_PARAMS} \
193-
${CONCORD_BFT_DOCKER_IMAGE_FULL_PATH}
196+
${CONCORD_BFT_ADDITIONAL_RUN_PARAMS} ${CONCORD_BFT_DOCKER_IMAGE_FULL_PATH}
194197

195198
.DEFAULT_GOAL:=build
196199

@@ -336,7 +339,7 @@ test: ## Run all tests
336339
${CONCORD_BFT_CONTAINER_SHELL} -c \
337340
"mkdir -p ${CONCORD_BFT_CORE_DIR} && \
338341
cd ${CONCORD_BFT_BUILD_DIR} && \
339-
ctest ${CONCORD_BFT_ADDITIONAL_CTEST_RUN_PARAMS} --timeout ${CONCORD_BFT_CTEST_TIMEOUT} --output-on-failure"
342+
ctest ${CONCORD_BFT_ADDITIONAL_CTEST_RUN_PARAMS} --timeout ${CONCORD_BFT_CTEST_TIMEOUT} || ${PRINT_FAILED_APOLLO_CASES}"
340343

341344
.PHONY: simple-test
342345
simple-test: ## Run Simple Test
@@ -350,7 +353,7 @@ test-range: ## Run all tests in the range [START,END], inclusive: `make test-ran
350353
${CONCORD_BFT_CONTAINER_SHELL} -c \
351354
"mkdir -p ${CONCORD_BFT_CORE_DIR} && \
352355
cd ${CONCORD_BFT_BUILD_DIR} && \
353-
ctest ${CONCORD_BFT_ADDITIONAL_CTEST_RUN_PARAMS} -I ${START},${END}"
356+
ctest ${CONCORD_BFT_ADDITIONAL_CTEST_RUN_PARAMS} -I ${START},${END} || ${PRINT_FAILED_APOLLO_CASES}"
354357

355358
# ctest allows repeating tests, but not with the exact needed behavior below.
356359
.PHONY: test-single-suite
@@ -362,7 +365,7 @@ test-single-suite: ## Run a single test `make test-single-suite TEST_NAME=<test
362365
echo "=== Starting iteration $${i}/${NUM_REPEATS__}"; \
363366
docker run ${BASIC_RUN_PARAMS} ${CONCORD_BFT_CONTAINER_SHELL} -c \
364367
"mkdir -p ${CONCORD_BFT_CORE_DIR} && cd ${CONCORD_BFT_BUILD_DIR} && \
365-
ctest ${CONCORD_BFT_ADDITIONAL_CTEST_RUN_PARAMS} -V -R ${TEST_NAME} --timeout ${CONCORD_BFT_CTEST_TIMEOUT} --output-on-failure"; \
368+
ctest ${CONCORD_BFT_ADDITIONAL_CTEST_RUN_PARAMS} -V -R ${TEST_NAME} --timeout ${CONCORD_BFT_CTEST_TIMEOUT}"; || ${PRINT_FAILED_APOLLO_CASES} \
366369
RESULT=$$?; \
367370
if [[ $${RESULT} -ne 0 ]];then \
368371
(( num_failures=num_failures+1 )); \

bftengine/include/bftengine/CryptoManager.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class CryptoManager : public IKeyExchanger, public IMultiSigKeyGenerator {
6161

6262
// IKeyExchanger methods
6363
// onPrivateKeyExchange and onPublicKeyExchange callbacks for a given checkpoint may be called in a different order.
64-
// Therefore the first called will create ca CryptoSys
64+
// Therefore the first called will create a CryptoSys
6565
void onPrivateKeyExchange(const std::string& secretKey,
6666
const std::string& verificationKey,
6767
const SeqNum& sn) override;
@@ -77,8 +77,8 @@ class CryptoManager : public IKeyExchanger, public IMultiSigKeyGenerator {
7777
* @param secretKey
7878
* @param verificationKey
7979
* @note: Assumes all keys are formatted as hex strings
80-
* @note: TODO: Current implementation is not crash consistent, a ST which was completed after the replica process
81-
* will lose the new private key
80+
* @note: TODO: Current implementation is not crash consistent, a ST which was completed after the termination
81+
* of the replica process will lose the new private key
8282
*/
8383
void syncPrivateKeyAfterST(const std::string& secretKey, const std::string& verificationKey);
8484

bftengine/src/bcstatetransfer/AsyncStateTransferCRE.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "MsgHandlersRegistrator.hpp"
1919
#include "MsgsCommunicator.hpp"
2020
#include "client/reconfiguration/client_reconfiguration_engine.hpp"
21+
#include "crypto/signer.hpp"
2122

2223
namespace bftEngine::bcst::asyncCRE {
2324
class CreFactory {

bftengine/src/bcstatetransfer/BCStateTran.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3431,9 +3431,9 @@ void BCStateTran::processData(bool lastInBatch, uint32_t rvbDigestsSize) {
34313431
LOG_ERROR(logger_, "Setting RVB digests into RVB manager failed!");
34323432
badDataFromCurrentSourceReplica = true;
34333433
} else {
3434-
#ifdef ENABLE_ALL_METRICS
3434+
#ifdef ENABLE_ALL_METRICS
34353435
metrics_.overall_rvb_digest_groups_validated_++;
3436-
#endif
3436+
#endif
34373437
}
34383438
}
34393439

bftengine/src/bftengine/CryptoManager.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
// file.
1111

1212
#include "ReplicaConfig.hpp"
13-
#include "Logger.hpp"
1413
#include "CryptoManager.hpp"
1514
#include <experimental/map>
1615

@@ -57,8 +56,6 @@ std::unique_ptr<Cryptosystem>& CryptoManager::getLatestCryptoSystem() const {
5756
*/
5857
concord::crypto::SignatureAlgorithm CryptoManager::getLatestSignatureAlgorithm() const {
5958
const std::unordered_map<std::string, concord::crypto::SignatureAlgorithm> typeToAlgorithm{
60-
{MULTISIG_BLS_SCHEME, concord::crypto::SignatureAlgorithm::BLS},
61-
{THRESHOLD_BLS_SCHEME, concord::crypto::SignatureAlgorithm::BLS},
6259
{MULTISIG_EDDSA_SCHEME, concord::crypto::SignatureAlgorithm::EdDSA},
6360
};
6461
auto currentType = getLatestCryptoSystem()->getType();

bftengine/src/bftengine/KeyExchangeManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ void KeyExchangeManager::registerNewKeyPair(uint16_t repID,
8989
candidate_private_keys_.generated.clear();
9090
// erasing seqnum from the map
9191
seq_candidate_map_.erase(sn);
92-
ConcordAssert(private_keys_.key_data().generated.pub == kemsg.pubkey);
92+
ConcordAssert(private_keys_.key_data().generated.pub == pubkey);
9393
private_keys_.onKeyExchange(cid, sn);
94-
for (auto e : registryToExchange_) e->onPrivateKeyExchange(private_keys_.key_data().keys[sn], kemsg.pubkey, sn);
94+
for (auto e : registryToExchange_) e->onPrivateKeyExchange(private_keys_.key_data().keys[sn], pubkey, sn);
9595
metrics_->self_key_exchange_counter++;
9696
}
9797

bftengine/src/bftengine/ReplicaBase.hpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,6 @@ class ReplicaBase {
9999
}
100100
}
101101

102-
/*bool validateMessage(MessageBase* msg) {
103-
try {
104-
if (config_.debugStatisticsEnabled) DebugStatistics::onReceivedExMessage(msg->type());
105-
106-
msg->validate(*repsInfo);
107-
return true;
108-
} catch (std::exception& e) {
109-
onReportAboutInvalidMessage(msg, e.what());
110-
return false;
111-
}
112-
}*/
113-
114102
protected:
115103
static const uint16_t ALL_OTHER_REPLICAS = UINT16_MAX;
116104

bftengine/src/bftengine/ReplicaImp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4437,7 +4437,7 @@ ReplicaImp::ReplicaImp(bool firstTime,
44374437
concord::crypto::KeyFormat::PemFormat,
44384438
{{repsInfo->getIdOfOperator(),
44394439
ReplicaConfig::instance().getOperatorPublicKey(),
4440-
concord::crypto::KeyFormat::PemFormat}}
4440+
concord::crypto::KeyFormat::PemFormat}},
44414441
*repsInfo);
44424442
viewsManager = new ViewsManager(repsInfo);
44434443
} else {

bftengine/src/bftengine/ReplicaImp.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,6 @@ class ReplicaImp : public InternalReplicaApi, public ReplicaForStateTransfer {
371371

372372
void recoverRequests();
373373

374-
template <typename MessageType>
375-
bool validateMessage(MessageType* msg);
376-
377374
std::function<bool(MessageBase*)> getMessageValidator();
378375

379376
// InternalReplicaApi
@@ -633,7 +630,7 @@ class ReplicaImp : public InternalReplicaApi, public ReplicaForStateTransfer {
633630
void addTimers();
634631
void startConsensusProcess(PrePrepareMsgUPtr pp, bool isCreatedEarlier);
635632
void startConsensusProcess(PrePrepareMsgUPtr pp);
636-
void clearClientRequestQueue();
633+
size_t clearClientRequestQueue();
637634
/**
638635
* Updates both seqNumInfo and slow_path metric
639636
* @param seqNumInfo

bftengine/src/bftengine/SigManager.cpp

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ SigManager* SigManager::instance() {
4949

5050
void SigManager::reset(std::shared_ptr<SigManager> other) { s_sm = other; }
5151

52-
std::shared_ptr<SigManager> SigManager::init(ReplicaId myId,
53-
const Key& mySigPrivateKey,
54-
const std::set<std::pair<PrincipalId, const std::string>>& publicKeysOfReplicas,
55-
KeyFormat replicasKeysFormat,
56-
const std::set<std::pair<const std::string, std::set<uint16_t>>>* publicKeysOfClients,
57-
KeyFormat clientsKeysFormat,
58-
const std::optional<std::tuple<PrincipalId, Key, concord::crypto::KeyFormat>>& operatorKey,
59-
const ReplicasInfo& replicasInfo) {
52+
std::shared_ptr<SigManager> SigManager::init(
53+
ReplicaId myId,
54+
const Key& mySigPrivateKey,
55+
const std::set<std::pair<PrincipalId, const std::string>>& publicKeysOfReplicas,
56+
KeyFormat replicasKeysFormat,
57+
const std::set<std::pair<const std::string, std::set<uint16_t>>>* publicKeysOfClients,
58+
KeyFormat clientsKeysFormat,
59+
const std::optional<std::tuple<PrincipalId, Key, concord::crypto::KeyFormat>>& operatorKey,
60+
const ReplicasInfo& replicasInfo) {
6061
vector<pair<Key, KeyFormat>> publickeys;
6162
map<PrincipalId, SigManager::KeyIndex> publicKeysMapping;
6263
size_t lowBound, highBound;
@@ -102,14 +103,14 @@ std::shared_ptr<SigManager> SigManager::init(ReplicaId myId,
102103
}
103104

104105
LOG_INFO(GL, "Done Compute Start ctor for SigManager with " << KVLOG(publickeys.size(), publicKeysMapping.size()));
105-
auto ret = std::shared_ptr<SigManager>{new SigManager(
106-
myId,
107-
make_pair(mySigPrivateKey, replicasKeysFormat),
108-
publickeys,
109-
publicKeysMapping,
110-
((ReplicaConfig::instance().clientTransactionSigningEnabled) && (publicKeysOfClients != nullptr)),
111-
operatorKey,
112-
replicasInfo)};
106+
auto ret = std::shared_ptr<SigManager>{
107+
new SigManager(myId,
108+
make_pair(mySigPrivateKey, replicasKeysFormat),
109+
publickeys,
110+
publicKeysMapping,
111+
((ReplicaConfig::instance().clientTransactionSigningEnabled) && (publicKeysOfClients != nullptr)),
112+
operatorKey,
113+
replicasInfo)};
113114

114115
reset(ret);
115116
return ret;
@@ -120,7 +121,7 @@ SigManager::SigManager(PrincipalId myId,
120121
const vector<pair<Key, KeyFormat>>& publickeys,
121122
const map<PrincipalId, KeyIndex>& publicKeysMapping,
122123
bool clientTransactionSigningEnabled,
123-
const std::optional<std::tuple<PrincipalId, Key, concord::crypto::KeyFormat>>& operatorKey
124+
const std::optional<std::tuple<PrincipalId, Key, concord::crypto::KeyFormat>>& operatorKey,
124125
const ReplicasInfo& replicasInfo)
125126
: myId_(myId),
126127
clientTransactionSigningEnabled_(clientTransactionSigningEnabled),

0 commit comments

Comments
 (0)