diff --git a/CMakeLists.txt b/CMakeLists.txt index 99243a7d..e62038f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,7 +103,7 @@ else() else() set(ARCH_FLAG "-march=${ARCH}") endif() - set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-aggregate-return") + set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-aggregate-return -Wno-comment") # if(NOT APPLE) # set(WARNINGS "${WARNINGS} -Werror") # endif() diff --git a/contrib/db/libmdbx/src/elements/internals.h b/contrib/db/libmdbx/src/elements/internals.h index 6aba3740..48ac8f41 100644 --- a/contrib/db/libmdbx/src/elements/internals.h +++ b/contrib/db/libmdbx/src/elements/internals.h @@ -54,7 +54,7 @@ #endif #if MDBX_DISABLE_GNU_SOURCE #undef _GNU_SOURCE -#elif defined(__linux__) || defined(__gnu_linux__) +#elif ( defined(__linux__) || defined(__gnu_linux__) ) && !defined(_GNU_SOURCE) #define _GNU_SOURCE #endif diff --git a/contrib/eos_portable_archive/eos/portable_iarchive.hpp b/contrib/eos_portable_archive/eos/portable_iarchive.hpp index cd087f34..d5a39e08 100644 --- a/contrib/eos_portable_archive/eos/portable_iarchive.hpp +++ b/contrib/eos_portable_archive/eos/portable_iarchive.hpp @@ -88,6 +88,25 @@ // basic headers #include + +// The following sixteen lines disable annoying message in Boost 1.70 (The use of BOOST_*_ENDIAN and BOOST_BYTE_ORDER is deprecated.) +#if BOOST_VERSION == 107000 && !defined(BOOST_PREDEF_DETAIL_ENDIAN_COMPAT_H) +# define BOOST_PREDEF_DETAIL_ENDIAN_COMPAT_H +# include +#if BOOST_ENDIAN_BIG_BYTE +# define BOOST_BIG_ENDIAN +# define BOOST_BYTE_ORDER 4321 +#endif +#if BOOST_ENDIAN_LITTLE_BYTE +# define BOOST_LITTLE_ENDIAN +# define BOOST_BYTE_ORDER 1234 +#endif +#if BOOST_ENDIAN_LITTLE_WORD +# define BOOST_PDP_ENDIAN +# define BOOST_BYTE_ORDER 2134 +#endif +#endif + #include #include #include diff --git a/contrib/epee/include/storages/portable_storage_from_json.h b/contrib/epee/include/storages/portable_storage_from_json.h index 4e74fb7a..fa76cc9b 100644 --- a/contrib/epee/include/storages/portable_storage_from_json.h +++ b/contrib/epee/include/storages/portable_storage_from_json.h @@ -30,7 +30,6 @@ namespace epee { - using namespace misc_utils::parse; namespace serialization { namespace json @@ -86,7 +85,7 @@ namespace epee switch(*it) { case '"': - match_string2(it, buf_end, name); + misc_utils::parse::match_string2(it, buf_end, name); state = match_state_waiting_separator; break; case '}': @@ -107,7 +106,7 @@ namespace epee if(*it == '"') {//just a named string value started std::string val; - match_string2(it, buf_end, val); + misc_utils::parse::match_string2(it, buf_end, val); //insert text value stg.set_value(name, val, current_section); state = match_state_wonder_after_value; @@ -115,7 +114,7 @@ namespace epee {//just a named number value started std::string val; bool is_v_float = false;bool is_signed = false; - match_number2(it, buf_end, val, is_v_float, is_signed); + misc_utils::parse::match_number2(it, buf_end, val, is_v_float, is_signed); if(!is_v_float) { if(is_signed) @@ -136,7 +135,7 @@ namespace epee }else if(isalpha(*it) ) {// could be null, true or false std::string word; - match_word2(it, buf_end, word); + misc_utils::parse::match_word2(it, buf_end, word); if(boost::iequals(word, "null")) { state = match_state_wonder_after_value; @@ -191,7 +190,7 @@ namespace epee { //mean array of strings std::string val; - match_string2(it, buf_end, val); + misc_utils::parse::match_string2(it, buf_end, val); h_array = stg.insert_first_value(name, val, current_section); CHECK_AND_ASSERT_THROW_MES(h_array, " failed to insert values entry"); state = match_state_array_after_value; @@ -200,7 +199,7 @@ namespace epee {//array of numbers value started std::string val; bool is_v_float = false;bool is_signed_val = false; - match_number2(it, buf_end, val, is_v_float, is_signed_val); + misc_utils::parse::match_number2(it, buf_end, val, is_v_float, is_signed_val); if(!is_v_float) { int64_t nval = boost::lexical_cast(val);//bool res = string_tools::string_to_num_fast(val, nval); @@ -222,7 +221,7 @@ namespace epee }else if(isalpha(*it) ) {// array of booleans std::string word; - match_word2(it, buf_end, word); + misc_utils::parse::match_word2(it, buf_end, word); if(boost::iequals(word, "true")) { h_array = stg.insert_first_value(name, true, current_section); @@ -266,7 +265,7 @@ namespace epee if(*it == '"') { std::string val; - match_string2(it, buf_end, val); + misc_utils::parse::match_string2(it, buf_end, val); bool res = stg.insert_next_value(h_array, val); CHECK_AND_ASSERT_THROW_MES(res, "failed to insert values"); state = match_state_array_after_value; @@ -277,7 +276,7 @@ namespace epee {//array of numbers value started std::string val; bool is_v_float = false;bool is_signed_val = false; - match_number2(it, buf_end, val, is_v_float, is_signed_val); + misc_utils::parse::match_number2(it, buf_end, val, is_v_float, is_signed_val); bool insert_res = false; if(!is_v_float) { @@ -299,7 +298,7 @@ namespace epee if(isalpha(*it) ) {// array of booleans std::string word; - match_word2(it, buf_end, word); + misc_utils::parse::match_word2(it, buf_end, word); if(boost::iequals(word, "true")) { bool r = stg.insert_next_value(h_array, true); diff --git a/contrib/epee/include/string_tools.h b/contrib/epee/include/string_tools.h index 95a5d88e..421335fd 100644 --- a/contrib/epee/include/string_tools.h +++ b/contrib/epee/include/string_tools.h @@ -23,16 +23,11 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // - - - #ifndef _STRING_TOOLS_H_ #define _STRING_TOOLS_H_ -//#include #include #include -//#include #include #include #include @@ -212,7 +207,7 @@ namespace string_tools t_pod_type parse_tpod_from_hex_string(const std::string& str_hash) { t_pod_type t_pod = AUTO_VAL_INIT(t_pod); - parse_tpod_from_hex_string(str_hash, t_pod); + epee::string_tools::parse_tpod_from_hex_string(str_hash, t_pod); // using fully qualified name to avoid Argument-Dependent Lookup issues return t_pod; } //---------------------------------------------------------------------------- @@ -322,13 +317,6 @@ POP_GCC_WARNINGS return true; } -/* template - bool get_xparam_from_command_line(const std::map& res, const std::basic_string & key, t_type& val) - { - - } - */ - template bool get_xparam_from_command_line(const std::map& res, const t_string & key, t_type& val) { @@ -803,6 +791,9 @@ POP_GCC_WARNINGS return buff; } #endif -} -} +} // namespace stringtools +} // namwspace epee + +namespace epst = epee::string_tools; // EPshort alias for convenience + #endif //_STRING_TOOLS_H_ diff --git a/contrib/epee/include/syncobj.h b/contrib/epee/include/syncobj.h index 07c0a484..9971ef12 100644 --- a/contrib/epee/include/syncobj.h +++ b/contrib/epee/include/syncobj.h @@ -711,4 +711,4 @@ namespace epee #define EXCLUSIVE_CRITICAL_REGION_BEGIN(x) { EXCLUSIVE_CRITICAL_REGION_LOCAL(x) #define EXCLUSIVE_CRITICAL_REGION_END() } -} +} // namespace epee diff --git a/src/common/crypto_boost_serialization.h b/src/common/crypto_serialization.h similarity index 56% rename from src/common/crypto_boost_serialization.h rename to src/common/crypto_serialization.h index 310c8e92..f17bfb36 100644 --- a/src/common/crypto_boost_serialization.h +++ b/src/common/crypto_serialization.h @@ -1,11 +1,9 @@ -// Copyright (c) 2014-2018 Zano Project +// Copyright (c) 2014-2022 Zano Project // Copyright (c) 2014-2018 The Louisdor Project // Copyright (c) 2012-2013 The Cryptonote developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. - #pragma once - #include #include #include @@ -13,7 +11,65 @@ #include #include #include + +#include "serialization/serialization.h" +#include "serialization/debug_archive.h" +#include "crypto/chacha8.h" #include "crypto/crypto.h" +#include "crypto/hash.h" +#include "crypto/range_proofs.h" +#include "boost_serialization_maps.h" + +// +// binary serialization +// + +namespace crypto +{ + struct bpp_signature_serialized : public crypto::bpp_signature + { + BEGIN_SERIALIZE_OBJECT() + FIELD(L) + FIELD(R) + FIELD(A0) + FIELD(A) + FIELD(B) + FIELD(r) + FIELD(s) + FIELD(delta) + END_SERIALIZE() + + BEGIN_BOOST_SERIALIZATION() + BOOST_SERIALIZE(L) + BOOST_SERIALIZE(R) + BOOST_SERIALIZE(A0) + BOOST_SERIALIZE(A) + BOOST_SERIALIZE(B) + BOOST_SERIALIZE(r) + BOOST_SERIALIZE(s) + BOOST_SERIALIZE(delta) + END_BOOST_SERIALIZATION() + }; +} + +BLOB_SERIALIZER(crypto::chacha8_iv); +BLOB_SERIALIZER(crypto::hash); +BLOB_SERIALIZER(crypto::public_key); +BLOB_SERIALIZER(crypto::secret_key); +BLOB_SERIALIZER(crypto::key_derivation); +BLOB_SERIALIZER(crypto::key_image); +BLOB_SERIALIZER(crypto::signature); +VARIANT_TAG(debug_archive, crypto::hash, "hash"); +VARIANT_TAG(debug_archive, crypto::public_key, "public_key"); +VARIANT_TAG(debug_archive, crypto::secret_key, "secret_key"); +VARIANT_TAG(debug_archive, crypto::key_derivation, "key_derivation"); +VARIANT_TAG(debug_archive, crypto::key_image, "key_image"); +VARIANT_TAG(debug_archive, crypto::signature, "signature"); + + +// +// Boost serialization +// namespace boost { @@ -51,7 +107,5 @@ namespace boost { a & reinterpret_cast(x); } - } -} - -//} + } // namespace serialization +} // namespace boost diff --git a/src/crypto/RIPEMD160_helper.cpp b/src/crypto/RIPEMD160_helper.cpp index 1386540a..9962802f 100644 --- a/src/crypto/RIPEMD160_helper.cpp +++ b/src/crypto/RIPEMD160_helper.cpp @@ -1,9 +1,6 @@ // Copyright (c) 2020 The Zano developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#pragma once - #include "RIPEMD160_helper.h" #include "auto_val_init.h" extern "C" { @@ -18,7 +15,7 @@ namespace crypto { { dword MDbuf[RMDsize / 32] = {0}; /* contains (A, B, C, D(, E)) */ - byte* hashcode = (byte*)&h; /* hashcode[RMDsize / 8]; /* for final hash-value */ + byte* hashcode = (byte*)&h; /* hashcode[RMDsize / 8]; for final hash-value */ dword X[16] = {0}; /* current 16-word chunk */ unsigned int i = 0; /* counter */ dword length = static_cast(length_size_t); /* length in bytes of message */ diff --git a/src/crypto/crypto-sugar.cpp b/src/crypto/crypto-sugar.cpp index 8b8779ae..b7298639 100644 --- a/src/crypto/crypto-sugar.cpp +++ b/src/crypto/crypto-sugar.cpp @@ -24,4 +24,6 @@ namespace crypto const point_t c_point_H2 = { 0x70c8d1ab9dbf1cc0, 0xc561bb12639a8516, 0x3cfff1def9e5b268, 0xe0936386f3bcce1a }; // == Hp("h2_generator"), cheched in bpp_basics const point_t c_point_0 = point_t(point_t::tag_zero()); + static_assert(sizeof(scalar_t::m_sk) == sizeof(scalar_t::m_u64) && sizeof(scalar_t::m_u64) == sizeof(scalar_t::m_s), "size missmatch"); + } // namespace crypto diff --git a/src/crypto/crypto-sugar.h b/src/crypto/crypto-sugar.h index a2681642..2ad22217 100644 --- a/src/crypto/crypto-sugar.h +++ b/src/crypto/crypto-sugar.h @@ -1,5 +1,5 @@ -// Copyright (c) 2020-2021 Zano Project -// Copyright (c) 2020-2021 sowle (val@zano.org, crypto.sowle@gmail.com) +// Copyright (c) 2020-2022 Zano Project +// Copyright (c) 2020-2022 sowle (val@zano.org, crypto.sowle@gmail.com) // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. // @@ -125,7 +125,7 @@ namespace crypto t_pod_type parse_tpod_from_hex_string(const std::string& hex_str) { t_pod_type t_pod = AUTO_VAL_INIT(t_pod); - parse_tpod_from_hex_string(hex_str, t_pod); + crypto::parse_tpod_from_hex_string(hex_str, t_pod); // using fully qualified name to avoid Argument-Dependent Lookup issues return t_pod; } @@ -136,8 +136,9 @@ namespace crypto { union { - uint64_t m_u64[4]; - unsigned char m_s[32]; + uint64_t m_u64[4]; + unsigned char m_s[32]; + crypto::secret_key m_sk; }; scalar_t() @@ -205,28 +206,22 @@ namespace crypto crypto::secret_key &as_secret_key() { - return *(crypto::secret_key*)&m_s[0]; + return m_sk; } const crypto::secret_key& as_secret_key() const { - return *(const crypto::secret_key*)&m_s[0]; + return m_sk; } operator crypto::secret_key() const { - crypto::secret_key result; - memcpy(result.data, &m_s, sizeof result.data); - return result; + return m_sk; } void from_secret_key(const crypto::secret_key& sk) { - uint64_t *p_sk64 = (uint64_t*)&sk; - m_u64[0] = p_sk64[0]; - m_u64[1] = p_sk64[1]; - m_u64[2] = p_sk64[2]; - m_u64[3] = p_sk64[3]; + m_sk = sk; // assuming secret key is correct (< L), so we don't need to call reduce here } diff --git a/src/currency_core/bc_offers_serialization.h b/src/currency_core/bc_offers_serialization.h index cee1e274..f786133f 100644 --- a/src/currency_core/bc_offers_serialization.h +++ b/src/currency_core/bc_offers_serialization.h @@ -13,7 +13,7 @@ #include #include #include "common/unordered_containers_boost_serialization.h" -#include "common/crypto_boost_serialization.h" +#include "common/crypto_serialization.h" #include "offers_service_basics.h" #include "offers_services_helpers.h" diff --git a/src/currency_core/blockchain_storage.h b/src/currency_core/blockchain_storage.h index e29d8889..67a649a0 100644 --- a/src/currency_core/blockchain_storage.h +++ b/src/currency_core/blockchain_storage.h @@ -395,7 +395,7 @@ namespace currency missed_bs.push_back(bl_id); else { - CHECK_AND_ASSERT_MES(*block_ind_ptr < m_db_blocks.size(), false, "Internal error: bl_id=" << string_tools::pod_to_hex(bl_id) + CHECK_AND_ASSERT_MES(*block_ind_ptr < m_db_blocks.size(), false, "Internal error: bl_id=" << epst::pod_to_hex(bl_id) << " have index record with offset=" << *block_ind_ptr << ", bigger then m_db_blocks.size()=" << m_db_blocks.size()); blocks.push_back(m_db_blocks[*block_ind_ptr]->bl); } @@ -531,9 +531,9 @@ namespace currency - mutable critical_section m_invalid_blocks_lock; + mutable epee::critical_section m_invalid_blocks_lock; blocks_ext_by_hash m_invalid_blocks; // crypto::hash -> block_extended_info - mutable critical_section m_alternative_chains_lock; + mutable epee::critical_section m_alternative_chains_lock; alt_chain_container m_alternative_chains; // crypto::hash -> alt_block_extended_info std::unordered_map m_alternative_chains_txs; // tx_id -> how many alt blocks it related to (always >= 1) std::unordered_map> m_altblocks_keyimages; // key image -> list of alt blocks hashes where it appears in inputs @@ -557,7 +557,7 @@ namespace currency mutable wide_difficulty_type m_cached_next_pow_difficulty; mutable wide_difficulty_type m_cached_next_pos_difficulty; - mutable critical_section m_targetdata_cache_lock; + mutable epee::critical_section m_targetdata_cache_lock; mutable std::list > m_pos_targetdata_cache; mutable std::list > m_pow_targetdata_cache; //work like a cache to avoid recalculation on read operations @@ -758,7 +758,7 @@ namespace currency } TIME_MEASURE_START_PD(tx_check_inputs_loop_scan_outputkeys_loop_find_tx); auto tx_ptr = m_db_transactions.find(tx_id); - CHECK_AND_ASSERT_MES(tx_ptr, false, "Wrong transaction id in output indexes: " << string_tools::pod_to_hex(tx_id)); + CHECK_AND_ASSERT_MES(tx_ptr, false, "Wrong transaction id in output indexes: " << epst::pod_to_hex(tx_id)); CHECK_AND_ASSERT_MES(n < tx_ptr->tx.vout.size(), false, "Wrong index in transaction outputs: " << n << ", expected less then " << tx_ptr->tx.vout.size()); //check mix_attr diff --git a/src/currency_core/currency_basic.h b/src/currency_core/currency_basic.h index 676d4f4d..9f14bfa1 100644 --- a/src/currency_core/currency_basic.h +++ b/src/currency_core/currency_basic.h @@ -26,7 +26,7 @@ #include "include_base_utils.h" #include "serialization/binary_archive.h" -#include "serialization/crypto.h" +#include "common/crypto_serialization.h" #include "serialization/stl_containers.h" #include "serialization/serialization.h" #include "serialization/variant.h" @@ -37,6 +37,7 @@ #include "currency_config.h" #include "crypto/crypto.h" #include "crypto/hash.h" +#include "crypto/range_proofs.h" #include "misc_language.h" #include "block_flags.h" #include "etc_custom_serialization.h" diff --git a/src/currency_core/currency_boost_serialization.h b/src/currency_core/currency_boost_serialization.h index 9b241bec..72d2bd4d 100644 --- a/src/currency_core/currency_boost_serialization.h +++ b/src/currency_core/currency_boost_serialization.h @@ -15,7 +15,7 @@ #include #include "currency_basic.h" #include "common/unordered_containers_boost_serialization.h" -#include "common/crypto_boost_serialization.h" +#include "common/crypto_serialization.h" #include "offers_services_helpers.h" #define CURRENT_BLOCK_ARCHIVE_VER 2 diff --git a/src/currency_core/currency_core.h b/src/currency_core/currency_core.h index 12dca924..feeca5f4 100644 --- a/src/currency_core/currency_core.h +++ b/src/currency_core/currency_core.h @@ -140,18 +140,18 @@ namespace currency tx_memory_pool m_mempool; i_currency_protocol* m_pprotocol; i_critical_error_handler* m_critical_error_handler; - critical_section m_incoming_tx_lock; + epee::critical_section m_incoming_tx_lock; miner m_miner; account_public_address m_miner_address; std::string m_config_folder; uint64_t m_stop_after_height; currency_protocol_stub m_protocol_stub; - math_helper::once_a_time_seconds<60*60*12, false> m_prune_alt_blocks_interval; - math_helper::once_a_time_seconds<60, true> m_check_free_space_interval; + epee::math_helper::once_a_time_seconds<60*60*12, false> m_prune_alt_blocks_interval; + epee::math_helper::once_a_time_seconds<60, true> m_check_free_space_interval; friend class tx_validate_inputs; std::atomic m_starter_message_showed; - critical_section m_blockchain_update_listeners_lock; + epee::critical_section m_blockchain_update_listeners_lock; std::vector m_blockchain_update_listeners; }; } diff --git a/src/currency_core/miner.h b/src/currency_core/miner.h index 69a4bdc7..ec011801 100644 --- a/src/currency_core/miner.h +++ b/src/currency_core/miner.h @@ -92,7 +92,7 @@ namespace currency volatile uint32_t m_stop; - ::critical_section m_template_lock; + epee::critical_section m_template_lock; block m_template; std::atomic m_template_no; std::atomic m_starter_nonce; @@ -101,15 +101,15 @@ namespace currency volatile uint32_t m_thread_index; volatile uint32_t m_threads_total; std::atomic m_pausers_count; - ::critical_section m_miners_count_lock; + epee::critical_section m_miners_count_lock; std::list m_threads; - ::critical_section m_threads_lock; + epee::critical_section m_threads_lock; i_miner_handler* m_phandler; //blockchain_storage& m_bc; account_public_address m_mine_address; - math_helper::once_a_time_seconds<5> m_update_block_template_interval; - math_helper::once_a_time_seconds<2> m_update_merge_hr_interval; + epee::math_helper::once_a_time_seconds<5> m_update_block_template_interval; + epee::math_helper::once_a_time_seconds<2> m_update_merge_hr_interval; std::vector m_extra_messages; miner_config m_config; std::string m_config_folder; diff --git a/src/currency_core/tx_pool.cpp b/src/currency_core/tx_pool.cpp index 581dfdb8..7f4d4495 100644 --- a/src/currency_core/tx_pool.cpp +++ b/src/currency_core/tx_pool.cpp @@ -40,6 +40,8 @@ DISABLE_VS_WARNINGS(4244 4345 4503) //'boost::foreach_detail_::or_' : decorated #define LOG_DEFAULT_CHANNEL "tx_pool" ENABLE_CHANNEL_BY_DEFAULT("tx_pool"); +using namespace epee; + namespace currency { //--------------------------------------------------------------------------------- diff --git a/src/currency_core/tx_pool.h b/src/currency_core/tx_pool.h index 4e660a68..c9de4748 100644 --- a/src/currency_core/tx_pool.h +++ b/src/currency_core/tx_pool.h @@ -6,7 +6,6 @@ #pragma once #include "include_base_utils.h" -using namespace epee; #include diff --git a/src/currency_protocol/currency_protocol_handler.inl b/src/currency_protocol/currency_protocol_handler.inl index 2ec82588..5c654e96 100644 --- a/src/currency_protocol/currency_protocol_handler.inl +++ b/src/currency_protocol/currency_protocol_handler.inl @@ -107,7 +107,7 @@ namespace currency std::stringstream conn_ss; time_t livetime = time(NULL) - cntxt.m_started; conn_ss << std::setw(29) << std::left << std::string(cntxt.m_is_income ? "[INC]":"[OUT]") + - string_tools::get_ip_string_from_int32(cntxt.m_remote_ip) + ":" + std::to_string(cntxt.m_remote_port) + epst::get_ip_string_from_int32(cntxt.m_remote_ip) + ":" + std::to_string(cntxt.m_remote_port) << std::setw(20) << std::hex << peer_id << std::setw(25) << std::to_string(cntxt.m_recv_cnt)+ "(" + std::to_string(time(NULL) - cntxt.m_last_recv) + ")" + "/" + std::to_string(cntxt.m_send_cnt) + "(" + std::to_string(time(NULL) - cntxt.m_last_send) + ")" << std::setw(25) << get_protocol_state_string(cntxt.m_state) @@ -523,7 +523,7 @@ namespace currency if(!parse_and_validate_block_from_blob(block_entry.block, b)) { LOG_ERROR_CCONTEXT("sent wrong block: failed to parse and validate block: \r\n" - << string_tools::buff_to_hex_nodelimer(block_entry.block) << "\r\n dropping connection"); + << epst::buff_to_hex_nodelimer(block_entry.block) << "\r\n dropping connection"); m_p2p->drop_connection(context); m_p2p->add_ip_fail(context.m_remote_ip); return 1; @@ -547,14 +547,14 @@ namespace currency auto req_it = context.m_priv.m_requested_objects.find(get_block_hash(b)); if(req_it == context.m_priv.m_requested_objects.end()) { - LOG_ERROR_CCONTEXT("sent wrong NOTIFY_RESPONSE_GET_OBJECTS: block with id=" << string_tools::pod_to_hex(get_blob_hash(block_entry.block)) + LOG_ERROR_CCONTEXT("sent wrong NOTIFY_RESPONSE_GET_OBJECTS: block with id=" << epst::pod_to_hex(get_blob_hash(block_entry.block)) << " wasn't requested, dropping connection"); m_p2p->drop_connection(context); return 1; } if(b.tx_hashes.size() != block_entry.txs.size()) { - LOG_ERROR_CCONTEXT("sent wrong NOTIFY_RESPONSE_GET_OBJECTS: block with id=" << string_tools::pod_to_hex(get_blob_hash(block_entry.block)) + LOG_ERROR_CCONTEXT("sent wrong NOTIFY_RESPONSE_GET_OBJECTS: block with id=" << epst::pod_to_hex(get_blob_hash(block_entry.block)) << ", tx_hashes.size()=" << b.tx_hashes.size() << " mismatch with block_complete_entry.m_txs.size()=" << block_entry.txs.size() << ", dropping connection"); m_p2p->drop_connection(context); return 1; @@ -575,7 +575,7 @@ namespace currency { m_core.pause_mine(); - misc_utils::auto_scope_leave_caller scope_exit_handler = misc_utils::create_scope_leave_handler( + epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler( boost::bind(&t_core::resume_mine, &m_core)); size_t count = 0; for (const block_complete_entry& block_entry : arg.blocks) @@ -593,7 +593,7 @@ namespace currency if (!parse_and_validate_tx_from_blob(tx_blob, tx, tx_id)) { LOG_ERROR_CCONTEXT("failed to parse tx: " - << string_tools::pod_to_hex(get_blob_hash(tx_blob)) << ", dropping connection"); + << epst::pod_to_hex(get_blob_hash(tx_blob)) << ", dropping connection"); m_p2p->drop_connection(context); return 1; } @@ -742,7 +742,7 @@ namespace currency << "\r\nm_remote_blockchain_height=" << context.m_remote_blockchain_height << "\r\nm_needed_objects.size()=" << context.m_priv.m_needed_objects.size() << "\r\nm_requested_objects.size()=" << context.m_priv.m_requested_objects.size() - << "\r\non connection [" << net_utils::print_connection_context_short(context)<< "]"); + << "\r\non connection [" << epee::net_utils::print_connection_context_short(context)<< "]"); context.m_state = currency_connection_context::state_normal; LOG_PRINT_GREEN("[REQUEST_MISSING_OBJECTS]: SYNCHRONIZED OK", LOG_LEVEL_0); @@ -919,7 +919,7 @@ namespace currency void t_currency_protocol_handler::set_to_debug_mode(uint32_t ip) { m_debug_ip_address = ip; - LOG_PRINT_L0("debug mode is set for IP " << epee::string_tools::get_ip_string_from_int32(m_debug_ip_address)); + LOG_PRINT_L0("debug mode is set for IP " << epst::get_ip_string_from_int32(m_debug_ip_address)); } //------------------------------------------------------------------------------------------------------------------------ template @@ -944,7 +944,7 @@ namespace currency if(!m_core.have_block(arg.m_block_ids.front().h)) { LOG_ERROR_CCONTEXT("sent m_block_ids starting from unknown id: " - << string_tools::pod_to_hex(arg.m_block_ids.front()) << " , dropping connection"); + << epst::pod_to_hex(arg.m_block_ids.front()) << " , dropping connection"); m_p2p->drop_connection(context); m_p2p->add_ip_fail(context.m_remote_ip); return 1; diff --git a/src/p2p/maintainers_info_boost_serialization.h b/src/p2p/maintainers_info_boost_serialization.h index fafc659e..b8b5df48 100644 --- a/src/p2p/maintainers_info_boost_serialization.h +++ b/src/p2p/maintainers_info_boost_serialization.h @@ -6,7 +6,7 @@ #pragma once #include "p2p_protocol_defs.h" -#include "common/crypto_boost_serialization.h" +#include "common/crypto_serialization.h" namespace boost { diff --git a/src/serialization/crypto.h b/src/serialization/crypto.h deleted file mode 100644 index c436b466..00000000 --- a/src/serialization/crypto.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014-2017 The The Louisdor Project -// Copyright (c) 2012-2013 The Cryptonote developers -// Distributed under the MIT/X11 software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include "serialization.h" -#include "debug_archive.h" -#include "crypto/chacha8.h" -#include "crypto/crypto.h" -#include "crypto/hash.h" - -/*// read -template