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

Trying to fix sfinae problems by reverting vcpkg upgrade (Iroha 1) #3852

Merged
merged 3 commits into from
Sep 1, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion iroha-cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <rapidjson/rapidjson.h>
#include <boost/filesystem.hpp>
#include <iostream>
#include <fstream>

#include "backend/protobuf/proto_block_json_converter.hpp"
#include "backend/protobuf/queries/proto_query.hpp"
Expand Down
1 change: 0 additions & 1 deletion irohad/ametsuchi/impl/flat_file/flat_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <iomanip>
#include <iostream>
#include <sstream>
#include <fstream>

#include "common/files.hpp"
#include "common/result.hpp"
Expand Down
18 changes: 8 additions & 10 deletions irohad/ametsuchi/impl/rocksdb_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ namespace iroha::ametsuchi {
Args &&... args) {
assert(format != nullptr);
return expected::makeError(
DbError{code, fmt::format(fmt::runtime(format), std::forward<Args>(args)...)});
DbError{code, fmt::format(format, std::forward<Args>(args)...)});
}

template <typename T>
Expand Down Expand Up @@ -1019,7 +1019,7 @@ namespace iroha::ametsuchi {
S const &fmtstring,
Args &&... args) {
keyBuffer().clear();
fmt::format_to(std::back_inserter(keyBuffer()), fmtstring, std::forward<Args>(args)...);
fmt::format_to(keyBuffer(), fmtstring, std::forward<Args>(args)...);

valueBuffer().clear();
rocksdb::Slice const slice(keyBuffer().data(), keyBuffer().size());
Expand Down Expand Up @@ -1052,7 +1052,7 @@ namespace iroha::ametsuchi {
S const &fmtstring,
Args &&... args) {
keyBuffer().clear();
fmt::format_to(std::back_inserter(keyBuffer()), fmtstring, std::forward<Args>(args)...);
fmt::format_to(keyBuffer(), fmtstring, std::forward<Args>(args)...);

rocksdb::Slice const slice(keyBuffer().data(), keyBuffer().size());
if (auto c = cache(); c && c->isCacheable(slice.ToStringView())
Expand All @@ -1074,7 +1074,7 @@ namespace iroha::ametsuchi {
S const &fmtstring,
Args &&... args) {
keyBuffer().clear();
fmt::format_to(std::back_inserter(keyBuffer()), fmtstring, std::forward<Args>(args)...);
fmt::format_to(keyBuffer(), fmtstring, std::forward<Args>(args)...);

rocksdb::Slice const slice(keyBuffer().data(), keyBuffer().size());
if (auto c = cache(); c && c->isCacheable(slice.ToStringView())) {
Expand All @@ -1092,7 +1092,7 @@ namespace iroha::ametsuchi {
S const &fmtstring,
Args &&... args) {
keyBuffer().clear();
fmt::format_to(std::back_inserter(keyBuffer()), fmt::runtime(fmtstring), std::forward<Args>(args)...);
fmt::format_to(keyBuffer(), fmtstring, std::forward<Args>(args)...);

rocksdb::ReadOptions ro;
ro.fill_cache = false;
Expand All @@ -1112,7 +1112,7 @@ namespace iroha::ametsuchi {
S const &fmtstring,
Args &&... args) {
keyBuffer().clear();
fmt::format_to(std::back_inserter(keyBuffer()), fmtstring, std::forward<Args>(args)...);
fmt::format_to(keyBuffer(), fmtstring, std::forward<Args>(args)...);
return enumerate(it, std::forward<F>(func));
}

Expand Down Expand Up @@ -1482,17 +1482,15 @@ namespace iroha::ametsuchi {
return value;
}

template <typename RetT, kDbOperation kOp, kDbEntry kSc, typename StrFormat, typename... Args>
template <typename RetT, kDbOperation kOp, kDbEntry kSc, typename... Args>
inline expected::Result<std::optional<RetT>, DbError> dbCall(
RocksDbCommon &common,
RocksDBPort::ColumnFamilyType cf_type,
const StrFormat& formatstr,
Args &&... args) {
auto status = executeOperation<kOp, kSc>(
common,
[&] { return fmt::format(fmt::runtime(formatstr), std::forward<Args>(args)...); },
[&] { return fmt::format(std::forward<Args>(args)...); },
cf_type,
formatstr,
std::forward<Args>(args)...);
RDB_ERROR_CHECK(status);
return loadValue<kOp, RetT>(common, status);
Expand Down
7 changes: 3 additions & 4 deletions irohad/ametsuchi/impl/rocksdb_wsv_command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "ametsuchi/impl/executor_common.hpp"
#include "ametsuchi/impl/rocksdb_common.hpp"
#include "ametsuchi/ledger_state.hpp"
#include "backend/protobuf/permissions.hpp"
#include "interfaces/common_objects/account.hpp"
#include "interfaces/common_objects/account_asset.hpp"
#include "interfaces/common_objects/asset.hpp"
Expand Down Expand Up @@ -148,10 +149,9 @@ namespace iroha::ametsuchi {
return {};
},
[&]() {
using underlying_type_for_grantable = std::underlying_type_t<decltype(permission)>;
return fmt::format("Insert account {} grantable permission {} for {}",
account_id,
static_cast<underlying_type_for_grantable>(permission),
permission,
permittee_account_id);
});
}
Expand Down Expand Up @@ -189,10 +189,9 @@ namespace iroha::ametsuchi {
return {};
},
[&]() {
using underlying_type_for_grantable = std::underlying_type_t<decltype(permission)>;
return fmt::format("Delete account {} grantable permission {} for {}",
account_id,
static_cast<underlying_type_for_grantable>(permission),
permission,
permittee_account_id);
});
}
Expand Down
8 changes: 6 additions & 2 deletions irohad/iroha_wsv_diff/iroha_wsv_diff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ DEFINE_validator(pg_opt, &ValidateNonEmpty);
// NOLINTNEXTLINE
DEFINE_string(rocksdb_path, "", "Specify path to RocksDB");
DEFINE_validator(rocksdb_path, &ValidateNonEmpty);
DEFINE_bool(ignore_checking_with_schema_version, false, "Should schema version be checked");

logger::LoggerManagerTreePtr getDefaultLogManager() {
return std::make_shared<logger::LoggerManagerTree>(logger::LoggerConfig{
Expand Down Expand Up @@ -651,8 +652,11 @@ bool Wsv::from_rocksdb(RocksDbCommon &rdbc) {
if (key_starts_with_and_drop(RDB_F_VERSION)) {
assert(key.empty());
schema_version = std::string{val};
assert(schema_version == "1#4#0" &&
"This version of iroha_wsv_diff can check WSV in RocksDB of version 1.2.0 only");
if (! FLAGS_ignore_checking_with_schema_version)
{
assert(schema_version == "1#4#0" &&
"This version of iroha_wsv_diff can check WSV in RocksDB of version 1.4.0 only");
}
} else if (key_starts_with_and_drop(RDB_NETWORK)) {
if (key_starts_with_and_drop(RDB_PEERS)) {
if (key_starts_with_and_drop(RDB_ADDRESS)) {
Expand Down
6 changes: 3 additions & 3 deletions irohad/util/shepherd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
*/

#include <iostream>
#include <type_traits>

#include "util/proto_status_tools.hpp"

#include <gflags/gflags.h>
#include "common/irohad_version.hpp"
Expand Down Expand Up @@ -48,8 +49,7 @@ DEFINE_bool(status, false, "Watch daemon statuses.");
DEFINE_validator(status, &validateSingleAction);

bool printStatus(const iroha::utility_service::Status &status) {
using underlying_statys_type = typename std::underlying_type_t<std::decay_t<decltype(status)>>;
::fmt::print("{}", static_cast<underlying_statys_type>(status));
::fmt::print("{}", status);
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion libs/common/to_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace iroha {

template <typename T>
inline auto toString(const T &o) -> std::enable_if_t<
boost::optional_detail::is_optional_or_tag<T>::value,
boost::optional_detail::is_optional_related<T>::value,
std::string> {
return detail::toStringDereferenced(o);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ProtoBlockJsonConverter::serialize(const interface::Block &block) const
google::protobuf::util::MessageToJsonString(proto_block, &result);

if (not status.ok()) {
return iroha::expected::makeError(status.message());
return iroha::expected::makeError(status.error_message());
}
return iroha::expected::makeValue(result);
}
Expand All @@ -35,7 +35,7 @@ ProtoBlockJsonConverter::deserialize(
iroha::protocol::Block block;
auto status = google::protobuf::util::JsonStringToMessage(json, &block);
if (not status.ok()) {
return iroha::expected::makeError(status.message());
return iroha::expected::makeError(status.error_message());
}
std::unique_ptr<interface::Block> result =
std::make_unique<Block>(std::move(block.block_v1()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace shared_model {
if (status.ok()) {
return result;
}
return status.message();
return status.error_message();
}
} // namespace protobuf
} // namespace converters
Expand Down
6 changes: 3 additions & 3 deletions test/tool/test_tool_iroha_wsv_diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ test_equal_wsv()(
## Make WSV in rocks database from block store
time $iroha_migrate -block_store_path="$BLOCK_STORE_PATH" -rocksdb_path "$ROCKSDB_PATH" $DROP_STATE

$iroha_wsv_diff -pg_opt "$PG_OPT" -rocksdb_path "$ROCKSDB_PATH"
$iroha_wsv_diff -pg_opt "$PG_OPT" -rocksdb_path "$ROCKSDB_PATH" -ignore_checking_with_schema_version

# ## No difference in dumps expected
diff <(tail -n+2 rockdb.wsv) <(tail -n+2 postgres.wsv)
Expand All @@ -83,7 +83,7 @@ update account_has_asset set amount = 0.0 where account_id = 'superuser@bootstra
END
trap 'echo clean-up; psql_with_params <revert1.sql >/dev/null' EXIT

if ! $iroha_wsv_diff -pg_opt "$PG_OPT" -rocksdb_path "$ROCKSDB_PATH" | tee log ;then
if ! $iroha_wsv_diff -pg_opt "$PG_OPT" -rocksdb_path "$ROCKSDB_PATH" -ignore_checking_with_schema_version | tee log ;then
grep -Fq <log '~~~ WSV-s DIFFER!!! ~~~'
grep -Fq <log "Role-s 'client' have different permissions: '00000000000001110100100100000100100100011010111010000' and '00000000000001110100100100000100100100011010111010011'"
grep -Fq <log 'Wsv-s have different roles.'
Expand Down Expand Up @@ -125,7 +125,7 @@ END
END
trap 'echo "clean-up."; psql_with_params <revert2.sql >/dev/null' EXIT

if ! $iroha_wsv_diff -pg_opt "$PG_OPT" -rocksdb_path "$ROCKSDB_PATH" | tee log ;then
if ! $iroha_wsv_diff -pg_opt "$PG_OPT" -rocksdb_path "$ROCKSDB_PATH" -ignore_checking_with_schema_version | tee log ;then
grep -Fq <log '~~~ WSV-s DIFFER!!! ~~~' log
grep -Fq <log "Role-s have different name: 'admin' and 'WRONG_ROLE'"
grep -Fq <log 'Wsv-s have different roles.'
Expand Down
2 changes: 1 addition & 1 deletion vcpkg/VCPKG_COMMIT_SHA
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a7b6122f6b6504d16d96117336a0562693579933
e8dbfcf6797a270ed5be8550248f7fe4fe5dec79

This file was deleted.

69 changes: 69 additions & 0 deletions vcpkg/patches/0002-rxcpp-from-master-2020-08-22.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
From 3bc6ec0f1e8903d745d6a950f3187432b7a04de8 Mon Sep 17 00:00:00 2001
From: kuvaldini <ivan@kuvaldini.pro>
Date: Wed, 26 May 2021 18:02:45 +0300
Subject: [PATCH] rxcpp from master 2020-08-22

---
ports/rxcpp/portfile.cmake | 5 ++--
ports/rxcpp/support_find_package.patch | 32 --------------------------
2 files changed, 2 insertions(+), 35 deletions(-)
delete mode 100644 ports/rxcpp/support_find_package.patch

diff --git a/ports/rxcpp/portfile.cmake b/ports/rxcpp/portfile.cmake
index b98701132..b11458d3c 100644
--- a/ports/rxcpp/portfile.cmake
+++ b/ports/rxcpp/portfile.cmake
@@ -1,10 +1,9 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ReactiveX/RxCpp
- REF v4.1.0
- SHA512 a92e817ecbdf6f235cae724ada2615af9fa0c243249625d0f2c2f09ff5dd7f53fdabd03a0278fe2995fe27528c5511d71f87b7a6b3d54f73b49b65aef56e32fd
+ REF 9002d9bea0e6b90624672e90a409b56de5286fc6
+ SHA512 5f4540df6bcb9a980026481a75719201cff0c2e3e957a51dd22d63399138133f13c3a7b5b507124acc635c633d16583768619d62d725a01c40dc31a2b2ece422
HEAD_REF master
- PATCHES support_find_package.patch
)

vcpkg_configure_cmake(
diff --git a/ports/rxcpp/support_find_package.patch b/ports/rxcpp/support_find_package.patch
deleted file mode 100644
index bb1da2d2d..000000000
--- a/ports/rxcpp/support_find_package.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt
-index 3d0744740..293f187c5 100644
---- a/projects/CMake/CMakeLists.txt
-+++ b/projects/CMake/CMakeLists.txt
-@@ -146,3 +146,27 @@ set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE CACHE BOOL "Don't require all project
-
- install(DIRECTORY ${RXCPP_DIR}/Rx/v2/src/rxcpp/ DESTINATION include/rxcpp
- FILES_MATCHING PATTERN "*.hpp")
-+
-+# Here we are exporting TARGETS so that other projects can import rxcpp
-+# just with find_package(rxcpp CONFIG) after rxcpp is installed into system by "make install".
-+add_library(rxcpp INTERFACE)
-+
-+target_include_directories(rxcpp INTERFACE
-+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
-+ $<INSTALL_INTERFACE:include/rxcpp>
-+)
-+
-+install(TARGETS rxcpp EXPORT rxcppConfig)
-+install(EXPORT rxcppConfig DESTINATION share/rxcpp/cmake)
-+
-+# When find_package(rxcpp SOME_VERSION REQUIRED) will be used in third party project
-+# where SOME_VERSION is any version incompatible with ${PROJECT_VERSION} then cmake will generate the error.
-+# It means you don't need track versions manually.
-+include(CMakePackageConfigHelpers)
-+write_basic_package_version_file("${PROJECT_BINARY_DIR}/rxcppConfigVersion.cmake"
-+ VERSION
-+ ${PROJECT_VERSION}
-+ COMPATIBILITY
-+ AnyNewerVersion
-+)
-+install(FILES "${PROJECT_BINARY_DIR}/rxcppConfigVersion.cmake" DESTINATION share/rxcpp/cmake)
--
2.31.1

Loading
Loading