1
0
Fork 0
forked from lthn/blockchain

merge with zarcanum

This commit is contained in:
cryptozoidberg 2022-05-14 20:12:44 +02:00
commit cfb9b463d7
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
31 changed files with 167 additions and 172 deletions

View file

@ -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()

View file

@ -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

View file

@ -88,6 +88,25 @@
// basic headers
#include <boost/version.hpp>
// 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 <boost/predef/other/endian.h>
#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 <boost/utility/enable_if.hpp>
#include <boost/archive/basic_binary_iprimitive.hpp>
#include <boost/archive/basic_binary_iarchive.hpp>

View file

@ -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<int64_t>(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);

View file

@ -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 <objbase.h>
#include <locale>
#include <cstdlib>
//#include <strsafe.h>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/lexical_cast.hpp>
@ -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<typename t_type>
bool get_xparam_from_command_line(const std::map<std::string, std::string>& res, const std::basic_string<typename t_string::value_type> & key, t_type& val)
{
}
*/
template<class t_string, typename t_type>
bool get_xparam_from_command_line(const std::map<t_string, t_string>& 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_

View file

@ -711,4 +711,4 @@ namespace epee
#define EXCLUSIVE_CRITICAL_REGION_BEGIN(x) { EXCLUSIVE_CRITICAL_REGION_LOCAL(x)
#define EXCLUSIVE_CRITICAL_REGION_END() }
}
} // namespace epee

View file

@ -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 <boost/serialization/vector.hpp>
#include <boost/serialization/utility.hpp>
#include <boost/serialization/variant.hpp>
@ -13,7 +11,65 @@
#include <boost/serialization/map.hpp>
#include <boost/foreach.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#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<char (&)[sizeof(crypto::hash)]>(x);
}
}
}
//}
} // namespace serialization
} // namespace boost

View file

@ -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<dword>(length_size_t); /* length in bytes of message */

View file

@ -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

View file

@ -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
}

View file

@ -13,7 +13,7 @@
#include <boost/foreach.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#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"

View file

@ -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<crypto::hash, size_t> m_alternative_chains_txs; // tx_id -> how many alt blocks it related to (always >= 1)
std::unordered_map<crypto::key_image, std::list<crypto::hash>> 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 <std::pair<wide_difficulty_type, uint64_t>> m_pos_targetdata_cache;
mutable std::list <std::pair<wide_difficulty_type, uint64_t>> 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

View file

@ -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"

View file

@ -15,7 +15,7 @@
#include <boost/serialization/is_bitwise_serializable.hpp>
#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

View file

@ -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<bool> m_starter_message_showed;
critical_section m_blockchain_update_listeners_lock;
epee::critical_section m_blockchain_update_listeners_lock;
std::vector<i_blockchain_update_listener*> m_blockchain_update_listeners;
};
}

View file

@ -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<uint32_t> m_template_no;
std::atomic<uint32_t> m_starter_nonce;
@ -101,15 +101,15 @@ namespace currency
volatile uint32_t m_thread_index;
volatile uint32_t m_threads_total;
std::atomic<int32_t> m_pausers_count;
::critical_section m_miners_count_lock;
epee::critical_section m_miners_count_lock;
std::list<boost::thread> 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<blobdata> m_extra_messages;
miner_config m_config;
std::string m_config_folder;

View file

@ -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
{
//---------------------------------------------------------------------------------

View file

@ -6,7 +6,6 @@
#pragma once
#include "include_base_utils.h"
using namespace epee;
#include <set>

View file

@ -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<t_core>::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<class t_core>
@ -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;

View file

@ -6,7 +6,7 @@
#pragma once
#include "p2p_protocol_defs.h"
#include "common/crypto_boost_serialization.h"
#include "common/crypto_serialization.h"
namespace boost
{

View file

@ -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 <template <bool> class Archive>
bool do_serialize(Archive<false> &ar, std::vector<crypto::signature> &v)
{
size_t cnt = v.size();
v.clear();
// very basic sanity check
if (ar.remaining_bytes() < cnt*sizeof(crypto::signature)) {
ar.stream().setstate(std::ios::failbit);
return false;
}
v.reserve(cnt);
for (size_t i = 0; i < cnt; i++) {
v.resize(i+1);
ar.serialize_blob(&(v[i]), sizeof(crypto::signature), "");
if (!ar.stream().good())
return false;
}
return true;
}
// write
template <template <bool> class Archive>
bool do_serialize(Archive<true> &ar, std::vector<crypto::signature> &v)
{
if (0 == v.size()) return true;
ar.begin_string();
size_t cnt = v.size();
for (size_t i = 0; i < cnt; i++) {
ar.serialize_blob(&(v[i]), sizeof(crypto::signature), "");
if (!ar.stream().good())
return false;
}
ar.end_string();
return true;
}*/
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");

View file

@ -368,7 +368,7 @@ namespace
void block_template_update_thread()
{
log_space::log_singletone::set_thread_log_prefix("[ST]");
epee::log_space::log_singletone::set_thread_log_prefix("[ST]");
while (!m_stop_flag)
{
if (is_core_syncronized() && epee::misc_utils::get_tick_count() - m_block_template_update_ts >= m_block_template_update_pediod_ms)

View file

@ -15,8 +15,6 @@ DISABLE_VS_WARNINGS(4503)
#include "include_base_utils.h"
#include "version.h"
using namespace epee;
#include "console_handler.h"
#include "p2p/net_node.h"
#include "currency_core/checkpoints_create.h"

View file

@ -43,6 +43,8 @@ if(NOT MSVC)
if(APPLE)
set_property(TARGET gtest gtest_main APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-unused-private-field")
endif()
target_link_libraries(coretests dl)
target_link_libraries(functional_tests dl)
endif()

View file

@ -781,8 +781,8 @@ bool construct_broken_tx(const currency::account_keys& sender_account_keys, cons
if (!(in_ephemeral.pub == src_entr.outputs[src_entr.real_output].second))
{
LOG_ERROR("derived public key missmatch with output public key! " << ENDL << "derived_key:"
<< string_tools::pod_to_hex(in_ephemeral.pub) << ENDL << "real output_public_key:"
<< string_tools::pod_to_hex(src_entr.outputs[src_entr.real_output].second));
<< epst::pod_to_hex(in_ephemeral.pub) << ENDL << "real output_public_key:"
<< epst::pod_to_hex(src_entr.outputs[src_entr.real_output].second));
return false;
}
@ -892,7 +892,7 @@ bool test_generator::construct_block_gentime_with_coinbase_cb(const currency::bl
size_t height = get_block_height(prev_block) + 1;
//size_t current_block_size = get_object_blobsize(miner_tx);
r = construct_miner_tx(height, misc_utils::median(block_sizes), already_generated_coins, 0 /* current_block_size !HACK! */, 0, acc.get_public_address(), acc.get_public_address(), miner_tx, get_tx_version(height, m_hardforks), currency::blobdata(), 1);
r = construct_miner_tx(height, epee::misc_utils::median(block_sizes), already_generated_coins, 0 /* current_block_size !HACK! */, 0, acc.get_public_address(), acc.get_public_address(), miner_tx, get_tx_version(height, m_hardforks), currency::blobdata(), 1);
CHECK_AND_ASSERT_MES(r, false, "construct_miner_tx failed");
if (!cb(miner_tx))
@ -983,7 +983,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
{ \
callback_entry ce = AUTO_VAL_INIT(ce); \
ce.callback_name = CB_NAME; \
ce.callback_params = epee::string_tools::pod_to_hex(PARAMS_POD_OBJ); \
ce.callback_params = epst::pod_to_hex(PARAMS_POD_OBJ); \
VEC_EVENTS.push_back(ce); \
PRINT_EVENT_NO(VEC_EVENTS); \
}

View file

@ -199,13 +199,13 @@ struct log_level_scope_changer
{
log_level_scope_changer(int desired_log_level)
{
m_original_log_level = log_space::get_set_log_detalisation_level();
log_space::get_set_log_detalisation_level(true, desired_log_level);
m_original_log_level = epee::log_space::get_set_log_detalisation_level();
epee::log_space::get_set_log_detalisation_level(true, desired_log_level);
}
~log_level_scope_changer()
{
log_space::get_set_log_detalisation_level(true, m_original_log_level);
epee::log_space::get_set_log_detalisation_level(true, m_original_log_level);
}
int m_original_log_level;

View file

@ -6,6 +6,7 @@
#include "chaingen.h"
#include "pos_block_builder.h"
using namespace epee;
using namespace currency;
pos_block_builder::pos_block_builder()

View file

@ -1177,7 +1177,7 @@ TEST(crypto, neg_identity)
// also do zero-byte pub key / key image checks
public_key zzz_pk;
memset(&zzz_pk, 0, sizeof public_key);
memset(&zzz_pk, 0, sizeof(public_key));
ASSERT_TRUE(check_key(zzz_pk));
@ -1186,7 +1186,7 @@ TEST(crypto, neg_identity)
ASSERT_FALSE(zzz.is_in_main_subgroup());
key_image zzz_ki;
memset(&zzz_ki, 0, sizeof key_image);
memset(&zzz_ki, 0, sizeof(key_image));
ASSERT_FALSE(validate_key_image(zzz_ki));
@ -1280,12 +1280,12 @@ TEST(ml2s, hs)
scalar_t x, y;
crypto::generate_random_bytes(32, y.m_s);
x = y;
memset(x.m_s + 18, 0xff, 13);
memset(x.m_s + 20, 0xff, 11);
sc_reduce32(x.m_s);
uint64_t lo = *(uint64_t*)(x.m_s + 18);
uint64_t hi = *(uint64_t*)(x.m_s + 26) & 0xffffffffff;
uint64_t lo = *(uint64_t*)(x.m_s + 20);
uint64_t hi = *(uint64_t*)(x.m_s + 28) & 0xffffff;
ASSERT_EQ(lo, 0xffffffffffffffff);
ASSERT_EQ(hi, 0xffffffffff);
ASSERT_EQ(hi, 0xffffff);
}
@ -1822,12 +1822,6 @@ TEST(crypto, sc_get_bit)
ASSERT_EQ(v.get_bit(static_cast<uint8_t>(n)), true);
}
// bits out of the [0; 255] range supposed to be always 0
for (size_t n = 256; n < 2048; ++n)
{
ASSERT_EQ(v.get_bit(static_cast<uint8_t>(n)), false);
}
// check random value
const scalar_t x = scalar_t::random();
for (size_t n = 0; n < 64; ++n)

View file

@ -139,7 +139,7 @@ TEST(bpp, power_256)
std::vector<std::vector<point_t>> commitments_vector;
commitments_vector.reserve(10);
std::vector<bpp_sig_commit_ref_t> sig_ñommit_refs;
std::vector<bpp_sig_commit_ref_t> sig_commit_refs;
uint8_t err = 0;
bool r = false;
@ -155,7 +155,7 @@ TEST(bpp, power_256)
r = bpp_gen<bpp_crypto_trait_zano<>>(values, masks, bpp_sig, commitments, &err);
ASSERT_TRUE(r);
sig_ñommit_refs.emplace_back(bpp_sig, commitments);
sig_commit_refs.emplace_back(bpp_sig, commitments);
}
{
@ -170,10 +170,10 @@ TEST(bpp, power_256)
r = bpp_gen<bpp_crypto_trait_zano<>>(values, masks, bpp_sig, commitments, &err);
ASSERT_TRUE(r);
sig_ñommit_refs.emplace_back(bpp_sig, commitments);
sig_commit_refs.emplace_back(bpp_sig, commitments);
}
r = bpp_verify<bpp_crypto_trait_zano<>>(sig_ñommit_refs, &err);
r = bpp_verify<bpp_crypto_trait_zano<>>(sig_commit_refs, &err);
ASSERT_TRUE(r);

View file

@ -105,7 +105,9 @@ struct naive_median
if (m_items.empty())
return;
if (fee_to_check != UINT64_MAX)
{
ASSERT_EQ(m_items.back().first, fee_to_check);
}
m_items.pop_back();
}

View file

@ -193,7 +193,9 @@ TEST(wallet_seed, basic_test)
if (r)
{
if (wse.timestamp)
{
ASSERT_EQ(wse.timestamp, acc.get_createtime());
}
ASSERT_EQ(wse.auditable, acc.get_public_address().is_auditable());