Skip to content

Commit

Permalink
[wsv_checker] (#1294)
Browse files Browse the repository at this point in the history
* [wsv_checker]
* [GHA] allow failing integration_fake_peer_examle_test, integration_remove_peer_test, timeout 60s

Signed-off-by: kuvaldini <ivan@kuvaldini.pro>
Signed-off-by: kuvaldini <47349143+kuvaldini@users.noreply.github.com>
  • Loading branch information
kuvaldini committed Aug 31, 2021
1 parent 606aea2 commit a31bbc3
Show file tree
Hide file tree
Showing 9 changed files with 1,096 additions and 45 deletions.
1 change: 1 addition & 0 deletions .github/build-iroha1.src.yml
Expand Up @@ -595,6 +595,7 @@ jobs:
module_gossip_propagation_strategy_test
integration_queries_acceptance_test
integration_fake_peer_example_test
integration_remove_peer_test
END
grep_failed_tests(){
grep 'The following tests FAILED:' -A10000 "$@" | tail +2 #| cut -d- -f2 | cut -d' ' -f2 | sort
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build-iroha1.yml
Expand Up @@ -638,6 +638,7 @@ jobs:
module_gossip_propagation_strategy_test
integration_queries_acceptance_test
integration_fake_peer_example_test
integration_remove_peer_test
END
grep_failed_tests(){
grep 'The following tests FAILED:' -A10000 "$@" | tail +2 #| cut -d- -f2 | cut -d' ' -f2 | sort
Expand Down Expand Up @@ -916,6 +917,7 @@ jobs:
module_gossip_propagation_strategy_test
integration_queries_acceptance_test
integration_fake_peer_example_test
integration_remove_peer_test
END
grep_failed_tests(){
grep 'The following tests FAILED:' -A10000 "$@" | tail +2 #| cut -d- -f2 | cut -d' ' -f2 | sort
Expand Down Expand Up @@ -1188,6 +1190,7 @@ jobs:
module_gossip_propagation_strategy_test
integration_queries_acceptance_test
integration_fake_peer_example_test
integration_remove_peer_test
END
grep_failed_tests(){
grep 'The following tests FAILED:' -A10000 "$@" | tail +2 #| cut -d- -f2 | cut -d' ' -f2 | sort
Expand Down
16 changes: 8 additions & 8 deletions example/config.sample
@@ -1,16 +1,16 @@
{
"torii_port" : 50051,
"internal_port" : 10001,
"torii_port": 50051,
"internal_port": 10001,
"database": {
"type": "rocksdb",
"path": "/path/to/wsv/folder"
},
"max_proposal_size" : 10,
"proposal_delay" : 5000,
"vote_delay" : 5000,
"mst_enable" : false,
"mst_expiration_time" : 1440,
"max_proposal_size": 10,
"proposal_delay": 5000,
"vote_delay": 5000,
"mst_enable": false,
"mst_expiration_time": 1440,
"max_rounds_delay": 3000,
"stale_stream_max_rounds": 2,
"metrics": "127.0.0.1:8080"
"metrics": "0.0.0.0:7001"
}
1 change: 1 addition & 0 deletions irohad/CMakeLists.txt
Expand Up @@ -17,3 +17,4 @@ add_subdirectory(multi_sig_transactions)
add_subdirectory(pending_txs_storage)
add_subdirectory(util)
add_subdirectory(maintenance)
add_subdirectory(wsv_checker)
47 changes: 11 additions & 36 deletions irohad/ametsuchi/impl/rocksdb_common.hpp
Expand Up @@ -36,8 +36,8 @@
* +-|WSV|-+-|NETWORK|-+-|PEERS|-+-|ADDRESS|-+-<peer_1_pubkey, value:address>
* | | | +-<peer_2_pubkey, value:address>
* | | |
* | | +-|TLS|-+-<peer_1, value:tls>
* | | | +-<peer_2, value:tls>
* | | +-|TLS|-+-<peer_1_pubkey, value:tls>
* | | | +-<peer_2_pubkey, value:tls>
* | | |
* | | +-<count, value>
* | |
Expand Down Expand Up @@ -91,8 +91,8 @@
* | | +-|ROLES|-+-<role_1, value:flag>
* | | | +-<role_2, value:flag>
* | | |
* | | +-|GRANTABLE_PER|-+-<account_id_1, value:permissions>
* | | | +-<account_id_2, value:permissions>
* | | +-|GRANTABLE_PER|-+-<permitee_id_1, value:permissions>
* | | | +-<permitee_id_2, value:permissions>
* | | |
* | | +-|SIGNATORIES|-+-<signatory_1>
* | | +-<signatory_2>
Expand Down Expand Up @@ -376,36 +376,6 @@ namespace iroha::ametsuchi::fmtstrings {

} // namespace iroha::ametsuchi::fmtstrings

#undef RDB_ADDRESS
#undef RDB_TLS
#undef RDB_OPTIONS
#undef RDB_F_ASSET_SIZE
#undef RDB_PATH_DOMAIN
#undef RDB_PATH_ACCOUNT
#undef RDB_F_QUORUM
#undef RDB_DELIMITER
#undef RDB_ROOT
#undef RDB_STORE
#undef RDB_WSV
#undef RDB_NETWORK
#undef RDB_SETTINGS
#undef RDB_ASSETS
#undef RDB_ROLES
#undef RDB_TRANSACTIONS
#undef RDB_ACCOUNTS
#undef RDB_PEERS
#undef RDB_STATUSES
#undef RDB_DETAILS
#undef RDB_GRANTABLE_PER
#undef RDB_POSITION
#undef RDB_TIMESTAMP
#undef RDB_DOMAIN
#undef RDB_SIGNATORIES
#undef RDB_ITEM
#undef RDB_F_TOP_BLOCK
#undef RDB_F_PEERS_COUNT
#undef RDB_F_TOTAL_COUNT
#undef RDB_F_VERSION

namespace {
auto constexpr kValue{FMT_STRING("{}")};
Expand Down Expand Up @@ -592,6 +562,9 @@ namespace iroha::ametsuchi {
if (!it->status().ok())
return it->status();

static_assert(std::is_convertible_v<std::result_of_t<F&(decltype(it),size_t)>, bool>,
"Required F(unique_ptr<rocksdb::Iterator>,size_t) -> bool");

rocksdb::Slice const key(keyBuffer().data(), keyBuffer().size());
for (; it->Valid() && it->key().starts_with(key); it->Next())
if (!std::forward<F>(func)(it, key.size()))
Expand Down Expand Up @@ -784,6 +757,8 @@ namespace iroha::ametsuchi {
F &&func,
S const &strformat,
Args &&... args) {
static_assert(std::is_convertible_v<std::result_of_t<F&(rocksdb::Slice)>, bool>,
"Must F(rocksdb::Slice) -> bool");
return rdb.enumerate(
[func{std::forward<F>(func)}](auto const &it,
auto const prefix_size) mutable {
Expand Down Expand Up @@ -1044,7 +1019,7 @@ namespace iroha::ametsuchi {
typename T,
typename = std::enable_if_t<std::is_same<T, bool>::value>>
inline std::optional<bool> loadValue(
RocksDbCommon &common,
RocksDbCommon&,
expected::Result<rocksdb::Status, DbError> const &status) {
std::optional<bool> value;
if constexpr (kOp == kDbOperation::kGet) {
Expand Down Expand Up @@ -1726,7 +1701,7 @@ namespace iroha::ametsuchi {
if (prev_writer.empty())
result += '\"';
else
result += "},\"";
result += "}, \"";
result += cur_writer;
result += "\": {";
prev_writer = cur_writer;
Expand Down
17 changes: 17 additions & 0 deletions irohad/wsv_checker/CMakeLists.txt
@@ -0,0 +1,17 @@
#
# Copyright Soramitsu Co., Ltd. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#

set(CMAKE_CXX_STANDARD 20)
add_executable(wsv_checker wsv_checker.cpp)
#target_compile_features(wsv_checker PUBLIC cxx_std_20)
#target_compile_options(wsv_checker PUBLIC -Werror -Wno-error=unused-variable)
target_link_libraries(wsv_checker PRIVATE
gflags
logger_manager
ametsuchi
)

find_package(nlohmann_json CONFIG REQUIRED)
target_link_libraries(wsv_checker PRIVATE nlohmann_json nlohmann_json::nlohmann_json)

0 comments on commit a31bbc3

Please sign in to comment.