Compare commits

...

21 Commits

Author SHA1 Message Date
jwinterm
0e65b21328 Merge pull request 'update readme and checkpoints [CI SKIP]' (#358) from wowario/wownero:checkpoint into master
Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/358
2021-01-27 12:28:22 +00:00
jwinterm
d886300416 Merge pull request 'upstream' (#357) from wowario/wownero:upstream into master
Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/357
2021-01-27 12:27:59 +00:00
jwinterm
c3e390d44d Merge pull request 'nudge time in approx_blockchain_height' (#356) from wowario/wownero:time into master
Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/356
2021-01-27 12:27:36 +00:00
jwinterm
f2f76de880 Merge pull request 'add more outputs to requested_outputs_count' (#355) from wowario/wownero:outputs into master
Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/355
2021-01-27 12:27:14 +00:00
wowario
89f650cf52 update checkpoints.dat 2021-01-17 23:07:59 +03:00
wowario
6cfba57fb0 bump version 2021-01-17 22:55:54 +03:00
wowario
d45df91391 update README.md 2021-01-17 22:55:30 +03:00
wowario
d95ab4b9e3 nudge time in approx_blockchain_height 2021-01-17 16:11:11 +03:00
wowario
8fe9ce706c add more outputs to requested_outputs_count 2021-01-17 16:02:32 +03:00
moneromooo-monero
9522d66815 p2p: only log to global when a blocked IP is not already blocked 2021-01-17 13:00:10 +03:00
Nym Seddon
66f7ea2dbf Split fuzz tests during fuzz build
Only build fuzz tests in a fuzz build, and don't build other tests.

Keeps fuzz compilers from instrumenting other tests, which are not fuzzed.

Resolves #7232
2021-01-17 12:59:57 +03:00
Denis Goddard
7dff3540f0 Header row for peer list in sync_info 2021-01-17 12:59:45 +03:00
moneromooo-monero
4679168a57 protocol: fix wrong command in logs
this is not a levin packet, this is just its payload
2021-01-17 12:59:34 +03:00
Suriyaa Sundararuban
fc745d7bc9 Update repo copyright year to 2021 2021-01-17 12:59:17 +03:00
moneromooo-monero
de01cb77d5 fuzz_tests: add a test for utf8canonical 2021-01-17 12:59:03 +03:00
codesoap
5d96c2c014 readline_buffer: Avoid consecutive duplicates in the history 2021-01-17 12:58:51 +03:00
moneromooo-monero
f17b506d3d protocol: add calls to reserve where appropriate 2021-01-17 12:58:40 +03:00
moneromooo-monero
2ec025d1a3 simplewallet: don't complain about connecting to the daemon when offline 2021-01-17 12:58:30 +03:00
moneromooo-monero
1212e1791c rpc: report target height as 0 when synced
since it only makes sense when syncing, and it confuses people
2021-01-17 12:58:15 +03:00
mj-xmr
fea538fcda Clang IWYU header checker script
Run with utils/health/clang-include-what-you-use-run.sh
2021-01-17 12:58:05 +03:00
mj-xmr
c1f0d43047 Run Valgrind checks for any binary in a list 2021-01-17 12:57:53 +03:00
24 changed files with 373 additions and 60 deletions

View File

@@ -1,4 +1,4 @@
Copyright (c) 2014-2020, The Monero Project
Copyright (c) 2014-2021, The Monero Project
All rights reserved.

View File

@@ -1,43 +1,34 @@
[![Build Status](https://ci.wownero.com/api/badges/wownero/wownero/status.svg)](https://ci.wownero.com/wownero/wownero)
# ~~Mo~~Wownero - Such privacy! Many coins! Wow! 🐕
Copyright (c) 2014-2020 The Monero Project.
Copyright (c) 2014-2021 The Monero Project.
Portions Copyright (c) 2012-2013 The Cryptonote developers.
## Resources
- Web: [wownero.org](http://wownero.org)
- Web: [wownero.org](https://wownero.org)
- Twitter: [@w0wn3r0](https://twitter.com/w0wn3r0)
- Reddit: [/r/wownero](https://www.reddit.com/r/wownero)
- Mail: [wownero@protonmail.com](mailto:wownero@protonmail.com)
- GitHub: [git.wownero.com/wownero/wownero](https://git.wownero.com/wownero/wownero)
- IRC: [#wownero on Freenode](https://kiwiirc.com/client/irc.freenode.net/?nick=suchchatter|?#wownero)
- Bitmessage Chan: wownero (`BM-2cSzWtrj2pzLva9GF1Jp2TYsnLjrnJpvba`)
- Git: [git.wownero.com/wownero/wownero](https://git.wownero.com/wownero/wownero)
- Wownero Funding System: [funding.wownero.com](https://funding.wownero.com)
- Wownero Forum: [forum.wownero.com](https://forum.wownero.com)
- Discord: [discord.gg/DSC9TWx](https://discord.gg/DSC9TWx)
- Discord: [discord.gg/ENbgme4bWq](https://discord.com/invite/ENbgme4bWq)
- Telegram: [t.me/wownero](https://t.me/wownero)
- Feather-WOW Desktop Wallet: [featherwallet.org/wownero](https://featherwallet.org/wownero)
- WOW Stash Web Wallet: [wowstash.app](https://wowstash.app)
- Public Node Status: [monero.fail](https://monero.fail/?crypto=wownero)
- Map of Nodes: [wownero.fyi](https://wownero.fyi)
- Wownero Memes: [suchwow.xyz]https://suchwow.xyz/posts/top)
- XMR/WOW Swap: [nero Swap](https://neroswap.com)
- Mining Pools: [miningpoolstats.stream](https://miningpoolstats.stream/wownero)
- Market Info: [coinmarketcap.com](https://coinmarketcap.com/currencies/wownero), [coingecko.com](https://www.coingecko.com/en/coins/wownero/usd)
### Blockchain Explorers
- https://explore.wownero.com
- http://wow5eqtzqvsg5jctqzg5g7uk3u62sfqiacj5x6lo4by7bvnj6jkvubyd.onion
- https://wownero.club
### Free Public Nodes
- global.wownodes.com:34568 (Global)
- node.suchwow.xyz:34568 (US)
- wow.pwned.systems:34568 (NL)
- wowbux.org:34568 (CA)
- super.fast.node.xmr.pm:34568 (DE)
- wow.pwned.systems (NL)
- wowbuxx535x4exuexja2xfezpwcyznxkofui4ndjiectj4yuh2xheiid.onion:34568
### Tor Peers
- wowp2p5gelm6vhl2d5tvfqills63jilgy6hkvlrqljooov5ktaxgqdad.onion
- f3moshycuklu3mb3wnlfjwn26nsgzreqtfzfuyjjk46u7jqxlhf7d5id.onion
- https://explorer.wownero.fyi
## Introduction
@@ -90,7 +81,7 @@ Dates are provided in the format YYYY-MM-DD.
| 114,969 | 2019-06-14 | F For Fappening | v0.6.1.0 | v0.6.1.2 | RandomWOW, new block weight algorithm, slightly more efficient RingCT format
| 160,777 | 2019-11-20 | Gaping Goatse | v0.7.0.0 | v0.7.1.0 | Only allow >= 2 outputs, change to the block median used to calculate penalty, rct sigs in coinbase forbidden, 4 unlock time as protocol rule
| - | 2020-06-28 | Hallucinogenic Hypnotoad | v0.8.0.0 | v0.8.0.2 | Dandelion++ support
| 253,999 | 2020-10-09 | Illiterate Illuminati | v0.9.0.0 | v0.9.2.1 | Dynamic coinbase unlock (up to 1 mo.), Deterministic unlock times, Enforce maximum coinbase amount, show_qr_code wallet command, CLSAG
| 253,999 | 2020-10-09 | Illiterate Illuminati | v0.9.0.0 | v0.9.2.2 | Dynamic coinbase unlock (up to 1 mo.), Deterministic unlock times, Enforce maximum coinbase amount, show_qr_code wallet command, CLSAG
X's indicate that these details have not been determined as of commit date.

View File

@@ -6,6 +6,7 @@
#include <boost/thread/lock_guard.hpp>
#include <boost/algorithm/string.hpp>
static bool same_as_last_line(const std::string&);
static void install_line_handler();
static void remove_line_handler();
@@ -175,8 +176,11 @@ static void handle_line(char* line)
boost::trim_right(test_line);
if(!test_line.empty())
{
add_history(test_line.c_str());
history_set_pos(history_length);
if (!same_as_last_line(test_line))
{
add_history(test_line.c_str());
history_set_pos(history_length);
}
if (test_line == "exit" || test_line == "q")
exit = true;
}
@@ -192,6 +196,16 @@ static void handle_line(char* line)
return;
}
// same_as_last_line returns true, if the last line in the history is
// equal to test_line.
static bool same_as_last_line(const std::string& test_line)
{
// Note that state->offset == state->length, when a new line was entered.
HISTORY_STATE* state = history_get_history_state();
return state->length > 0
&& test_line.compare(state->entries[state->length-1]->line) == 0;
}
static char* completion_matches(const char* text, int state)
{
static size_t list_index;

View File

@@ -14,8 +14,8 @@ then
exit 1
fi
case "$type" in
block|transaction|signature|cold-outputs|cold-transaction|load-from-binary|load-from-json|base58|parse-url|http-client|levin|bulletproof) ;;
*) echo "usage: $0 block|transaction|signature|cold-outputs|cold-transaction|load-from-binary|load-from-json|base58|parse-url|http-client|levin|bulletproof"; exit 1 ;;
block|transaction|signature|cold-outputs|cold-transaction|load-from-binary|load-from-json|base58|parse-url|http-client|levin|bulletproof|utf8) ;;
*) echo "usage: $0 block|transaction|signature|cold-outputs|cold-transaction|load-from-binary|load-from-json|base58|parse-url|http-client|levin|bulletproof|utf8"; exit 1 ;;
esac
if test -d "fuzz-out/$type"

Binary file not shown.

View File

@@ -200,7 +200,7 @@ namespace cryptonote
return true;
}
// make RPC call to daemon
// curl http://127.0.0.1:34568/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block","params":{"height":278300}}' -H 'Content-Type: application/json'
// curl http://127.0.0.1:34568/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block","params":{"height":282700}}' -H 'Content-Type: application/json'
// "wide_cumulative_difficulty": "0x14eb4d0131fe8",
ADD_CHECKPOINT2(1, "97f4ce4d7879b3bea54dcec738cd2ebb7952b4e9bb9743262310cd5fec749340", "0x2");
ADD_CHECKPOINT2(6969, "aa7b66e8c461065139b55c29538a39c33ceda93e587f84d490ed573d80511c87", "0x118eef693fd"); //Hard fork to v8
@@ -216,6 +216,7 @@ namespace cryptonote
ADD_CHECKPOINT2(256700, "389a8ab95a80e84ec74639c1078bc67b33af208ef00f53bd9609cfc40efa7059", "0x185ace3c1bd68");
ADD_CHECKPOINT2(271600, "9597cdbdc52ca57d7dbd8f9c0a23a73194ef2ebbcfdc75c21992672706108d43", "0x1e2d2d6a2a9e8");
ADD_CHECKPOINT2(278300, "b10dcdf7a51651f60fbcc0447409773eef1458d2c706d9a61daf467571ac19c9", "0x20a83a16d3968");
ADD_CHECKPOINT2(282700, "79c06cafd7cb5f76bcebbf8f1ae16203bb41fd75b284bcd0eb0b457991ab7d4a", "0x22e3baf142de8");
return true;
}

View File

@@ -5460,7 +5460,7 @@ void Blockchain::cancel()
}
#if defined(PER_BLOCK_CHECKPOINT)
static const char expected_block_hashes_hash[] = "44393af098c4738ecbe664292bc345c0acb40573562cac8bb67cea75debe9f1b";
static const char expected_block_hashes_hash[] = "cd0bfa35324c7486bf92d6d1058ad95df89f6c186dabd652e53a560ee5863b06";
void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get_checkpoints)
{
if (get_checkpoints == nullptr || !m_fast_sync)

View File

@@ -549,6 +549,7 @@ namespace cryptonote
}
std::vector<tx_blob_entry> have_tx;
have_tx.reserve(new_block.tx_hashes.size());
// Instead of requesting missing transactions by hash like BTC,
// we do it by index (thanks to a suggestion from moneromooo) because
@@ -557,6 +558,7 @@ namespace cryptonote
// Also, remember to pepper some whitespace changes around to bother
// moneromooo ... only because I <3 him.
std::vector<uint64_t> need_tx_indices;
need_tx_indices.reserve(new_block.tx_hashes.size());
transaction tx;
crypto::hash tx_hash;
@@ -829,6 +831,7 @@ namespace cryptonote
}
std::vector<crypto::hash> txids;
txids.reserve(b.tx_hashes.size());
NOTIFY_NEW_FLUFFY_BLOCK::request fluffy_response;
fluffy_response.b.block = t_serializable_object_to_blob(b);
fluffy_response.current_blockchain_height = arg.current_blockchain_height;
@@ -2189,6 +2192,7 @@ skip:
if (span.second > 0)
{
is_next = true;
req.blocks.reserve(hashes.size());
for (const auto &hash: hashes)
{
req.blocks.push_back(hash);
@@ -2247,6 +2251,7 @@ skip:
if (span.second > 0)
{
is_next = true;
req.blocks.reserve(hashes.size());
for (const auto &hash: hashes)
{
req.blocks.push_back(hash);
@@ -2280,6 +2285,7 @@ skip:
return false;
}
req.blocks.reserve(req.blocks.size() + span.second);
for (size_t n = 0; n < span.second; ++n)
{
req.blocks.push_back(context.m_needed_objects[n].first);
@@ -2579,6 +2585,7 @@ skip:
}
context.m_needed_objects.clear();
context.m_needed_objects.reserve(arg.m_block_ids.size());
uint64_t added = 0;
std::unordered_set<crypto::hash> blocks_found;
bool first = true;

View File

@@ -51,14 +51,6 @@
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.p2p.tx"
namespace
{
int get_command_from_message(const epee::byte_slice &msg)
{
return msg.size() >= sizeof(epee::levin::bucket_head2) ? SWAP32LE(((epee::levin::bucket_head2*)msg.data())->m_command) : 0;
}
}
namespace cryptonote
{
namespace levin
@@ -212,7 +204,7 @@ namespace levin
{
const epee::byte_slice blob = make_tx_payload(std::move(txs), pad, fluff);
p2p.for_connection(destination, [&blob](detail::p2p_context& context) {
on_levin_traffic(context, true, true, false, blob.size(), get_command_from_message(blob));
on_levin_traffic(context, true, true, false, blob.size(), NOTIFY_NEW_TRANSACTIONS::ID);
return true;
});
return p2p.notify(NOTIFY_NEW_TRANSACTIONS::ID, epee::to_span(blob), destination);

View File

@@ -2275,6 +2275,7 @@ bool t_rpc_command_executor::sync_info()
tools::success_msg_writer() << "Next needed pruning seed: " << res.next_needed_pruning_seed;
tools::success_msg_writer() << std::to_string(res.peers.size()) << " peers";
tools::success_msg_writer() << "Remote Host Peer_ID State Prune_Seed Height DL kB/s, Queued Blocks / MB";
for (const auto &p: res.peers)
{
std::string address = epee::string_tools::pad_string(p.info.address, 24);

View File

@@ -234,6 +234,7 @@ namespace nodetool
return false;
const time_t now = time(nullptr);
bool added = false;
CRITICAL_REGION_LOCAL(m_blocked_hosts_lock);
time_t limit;
@@ -244,7 +245,10 @@ namespace nodetool
const std::string host_str = addr.host_str();
auto it = m_blocked_hosts.find(host_str);
if (it == m_blocked_hosts.end())
{
m_blocked_hosts[host_str] = limit;
added = true;
}
else if (it->second < limit || !add_only)
it->second = limit;
@@ -275,7 +279,10 @@ namespace nodetool
conns.clear();
}
MCLOG_CYAN(el::Level::Info, "global", "Host " << host_str << " blocked.");
if (added)
MCLOG_CYAN(el::Level::Info, "global", "Host " << host_str << " blocked.");
else
MINFO("Host " << host_str << " block time updated.");
return true;
}
//-----------------------------------------------------------------------------------

View File

@@ -452,7 +452,7 @@ namespace cryptonote
m_core.get_blockchain_top(res.height, top_hash);
++res.height; // turn top block height into blockchain height
res.top_block_hash = string_tools::pod_to_hex(top_hash);
res.target_height = m_core.get_target_blockchain_height();
res.target_height = m_p2p.get_payload_object().is_synchronized() ? 0 : m_core.get_target_blockchain_height();
store_difficulty(m_core.get_blockchain_storage().get_difficulty_for_next_block(), res.difficulty, res.wide_difficulty, res.difficulty_top64);
res.target = m_core.get_blockchain_storage().get_difficulty_target();
res.tx_count = m_core.get_blockchain_storage().get_total_transactions() - res.height; //without coinbase
@@ -2915,7 +2915,7 @@ namespace cryptonote
crypto::hash top_hash;
m_core.get_blockchain_top(res.height, top_hash);
++res.height; // turn top block height into blockchain height
res.target_height = m_core.get_target_blockchain_height();
res.target_height = m_p2p.get_payload_object().is_synchronized() ? 0 : m_core.get_target_blockchain_height();
res.next_needed_pruning_seed = m_p2p.get_payload_object().get_next_needed_pruning_stripe().second;
for (const auto &c: m_p2p.get_payload_object().get_connections())

View File

@@ -4745,9 +4745,14 @@ bool simple_wallet::try_connect_to_daemon(bool silent, uint32_t* version)
if (!m_wallet->check_connection(version))
{
if (!silent)
fail_msg_writer() << tr("wallet failed to connect to daemon: ") << m_wallet->get_daemon_address() << ". " <<
tr("Daemon either is not started or wrong port was passed. "
"Please make sure daemon is running or change the daemon address using the 'set_daemon' command.");
{
if (m_wallet->is_offline())
fail_msg_writer() << tr("wallet failed to connect to daemon, because it is set to offline mode");
else
fail_msg_writer() << tr("wallet failed to connect to daemon: ") << m_wallet->get_daemon_address() << ". " <<
tr("Daemon either is not started or wrong port was passed. "
"Please make sure daemon is running or change the daemon address using the 'set_daemon' command.");
}
return false;
}
if (!m_allow_mismatched_daemon_version && ((*version >> 16) != CORE_RPC_VERSION_MAJOR))
@@ -9278,7 +9283,7 @@ bool simple_wallet::run()
refresh_main(0, ResetNone, true);
m_auto_refresh_enabled = m_wallet->auto_refresh();
m_auto_refresh_enabled = !m_wallet->is_offline() && m_wallet->auto_refresh();
m_idle_thread = boost::thread([&]{wallet_idle_thread();});
message_writer(console_color_green, false) << "Background refresh thread started";

View File

@@ -1,5 +1,5 @@
#define DEF_MONERO_VERSION_TAG "@VERSIONTAG@"
#define DEF_MONERO_VERSION "0.9.2.1"
#define DEF_MONERO_VERSION "0.9.2.2"
#define DEF_MONERO_RELEASE_NAME "Illiterate Illuminati"
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
#define DEF_MONERO_VERSION_IS_RELEASE @VERSION_IS_RELEASE@

View File

@@ -8218,12 +8218,12 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
const transfer_details &td = m_transfers[idx];
const uint64_t amount = td.is_rct() ? 0 : td.amount();
std::unordered_set<uint64_t> seen_indices;
uint64_t approx_blockchain_height = m_nettype == TESTNET ? 0 : (time(NULL) - 1522624244)/317;
uint64_t approx_blockchain_height = m_nettype == TESTNET ? 0 : (time(NULL) - 1522624244)/313;
uint64_t unlock_height = td.m_block_height + std::max<uint64_t>(CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE, CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS);
if (td.m_tx.unlock_time < CRYPTONOTE_MAX_BLOCK_NUMBER && td.m_tx.unlock_time > unlock_height)
unlock_height = td.m_tx.unlock_time;
uint64_t blocks_to_unlock = unlock_height > approx_blockchain_height ? unlock_height - approx_blockchain_height : 0;
size_t requested_outputs_count = base_requested_outputs_count + (td.is_rct() ? blocks_to_unlock - CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE : 0);
size_t requested_outputs_count = base_requested_outputs_count + (td.is_rct() ? blocks_to_unlock - CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE : 0) + 288;
size_t start = req.outputs.size();
bool use_histogram = amount != 0 || !has_rct_distribution;
@@ -8539,12 +8539,12 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
for(size_t idx: selected_transfers)
{
const transfer_details &td = m_transfers[idx];
uint64_t approx_blockchain_height = m_nettype == TESTNET ? 0 : (time(NULL) - 1522624244)/317;
uint64_t approx_blockchain_height = m_nettype == TESTNET ? 0 : (time(NULL) - 1522624244)/313;
uint64_t unlock_height = td.m_block_height + std::max<uint64_t>(CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE, CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS);
if (td.m_tx.unlock_time < CRYPTONOTE_MAX_BLOCK_NUMBER && td.m_tx.unlock_time > unlock_height)
unlock_height = td.m_tx.unlock_time;
uint64_t blocks_to_unlock = unlock_height > approx_blockchain_height ? unlock_height - approx_blockchain_height : 0;
size_t requested_outputs_count = base_requested_outputs_count + (td.is_rct() ? blocks_to_unlock - CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE : 0);
size_t requested_outputs_count = base_requested_outputs_count + (td.is_rct() ? blocks_to_unlock - CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE : 0) + 288;
outs.push_back(std::vector<get_outs_entry>());
outs.back().reserve(fake_outputs_count + 1);
const rct::key mask = td.is_rct() ? rct::commit(td.amount(), td.m_mask) : rct::zeroCommit(td.amount());
@@ -12124,7 +12124,7 @@ uint64_t wallet2::get_daemon_blockchain_target_height(string &err)
uint64_t wallet2::get_approximate_blockchain_height() const
{
uint64_t approx_blockchain_height = m_nettype == TESTNET ? 0 : (time(NULL) - 1522624244)/315;
uint64_t approx_blockchain_height = m_nettype == TESTNET ? 0 : (time(NULL) - 1522624244)/313;
LOG_PRINT_L2("Calculated blockchain height: " << approx_blockchain_height);
return approx_blockchain_height;
}

View File

@@ -1546,6 +1546,7 @@ private:
void finish_rescan_bc_keep_key_images(uint64_t transfer_height, const crypto::hash &hash);
void enable_dns(bool enable) { m_use_dns = enable; }
void set_offline(bool offline = true);
bool is_offline() const { return m_offline; }
uint64_t credits() const { return m_rpc_payment_state.credits; }
void credit_report(uint64_t &expected_spent, uint64_t &discrepancy) const { expected_spent = m_rpc_payment_state.expected_spent; discrepancy = m_rpc_payment_state.discrepancy; }

View File

@@ -80,17 +80,22 @@ file(COPY
data/signed_monero_tx
DESTINATION data)
add_subdirectory(core_tests)
add_subdirectory(fuzz)
add_subdirectory(crypto)
add_subdirectory(functional_tests)
add_subdirectory(performance_tests)
add_subdirectory(core_proxy)
add_subdirectory(unit_tests)
add_subdirectory(difficulty)
add_subdirectory(block_weight)
add_subdirectory(hash)
add_subdirectory(net_load_tests)
if (CMAKE_BUILD_TYPE STREQUAL "fuzz" OR OSSFUZZ)
add_subdirectory(fuzz)
else ()
add_subdirectory(core_tests)
add_subdirectory(fuzz)
add_subdirectory(crypto)
add_subdirectory(functional_tests)
add_subdirectory(performance_tests)
add_subdirectory(core_proxy)
add_subdirectory(unit_tests)
add_subdirectory(difficulty)
add_subdirectory(block_weight)
add_subdirectory(hash)
add_subdirectory(net_load_tests)
endif()
if (BUILD_GUI_DEPS)
add_subdirectory(libwallet_api_tests)
endif()

View File

BIN
tests/data/fuzz/utf8/UTF8_2 Normal file

Binary file not shown.

View File

@@ -218,3 +218,13 @@ set_property(TARGET tx-extra_fuzz_tests
PROPERTY
FOLDER "tests")
monero_add_minimal_executable(utf8_fuzz_tests utf8.cpp fuzzer.cpp)
target_link_libraries(utf8_fuzz_tests
PRIVATE
common
epee
${Boost_THREAD_LIBRARY}
${Boost_CHRONO_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${EXTRA_LIBRARIES}
$ENV{LIB_FUZZING_ENGINE})

39
tests/fuzz/utf8.cpp Normal file
View File

@@ -0,0 +1,39 @@
// Copyright (c) 2017-2020, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "include_base_utils.h"
#include "file_io_utils.h"
#include "common/utf8.h"
#include "fuzzer.h"
BEGIN_INIT_SIMPLE_FUZZER()
END_INIT_SIMPLE_FUZZER()
BEGIN_SIMPLE_FUZZER()
tools::utf8canonical(std::string((const char*)buf, len), [](wint_t c)->wint_t { return c; });
END_SIMPLE_FUZZER()

View File

@@ -15,6 +15,10 @@ On the first run, the script will complain about the missing ClangBuildAnalyzer
`utils/health/clang-tidy-run.sh`
Performs Lint checks on the source code and stores the result in the build directory. More information on the [home page](https://clang.llvm.org/extra/clang-tidy/).
##include-what-you-use
`utils/health/clang-include-what-you-use-run.sh`
Analyses the header file hierarchy and delivers hints on how to reduce their complexity. More information on the [home page](https://include-what-you-use.org/).
##Valgrind checks
`utils/health/valgrind-tests.sh`

View File

@@ -0,0 +1,75 @@
#!/bin/bash -e
# Copyright (c) 2014-2020, The Monero Project
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be
# used to endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Include What You Use analyses the complexity of your header hierarchy and proposes optimisations.
# User documentation:
# https://github.com/include-what-you-use/include-what-you-use/blob/master/README.md
# Build variables
PROG="include-what-you-use"
PROG_SHORT="iwyu"
DIR_BUILD="build/clang-$PROG_SHORT"
RESULT="$PROG_SHORT-result.txt"
if hash "$PROG"; then
echo "Found: $PROG"
else
echo "Couldn't find: $PROG"
echo "Please run the below command to install $PROG:"
echo "sudo apt install $PROG_SHORT"
exit 1
fi
mkdir -p "$DIR_BUILD" && cd "$DIR_BUILD"
rm `find . -name "CMakeCache.txt"` || true
UWYU_COMMAND="$PROG;-Xiwyu;any;-Xiwyu;iwyu;-Xiwyu;args" # Copy-pasted from the user docs.
cmake ../.. \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DUSE_CCACHE=ON \
-DCMAKE_C_INCLUDE_WHAT_YOU_USE="$UWYU_COMMAND" \
-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="$UWYU_COMMAND" \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTS=ON
make clean # Clean up to generate the full report
time make -k 2>&1 | tee "$RESULT" # Run the scan. -k means: ignore errors
#time make -k easylogging 2>&1 | tee $RESULT # Quick testing: build a single target
KPI=$(cat "$RESULT" | wc -l)
tar -cJvf "$RESULT.txz" "$RESULT" # Zip the result, because it's huge.
rm -v "$RESULT"
echo ""
echo "Readable result stored in: $DIR_BUILD/$RESULT.gz"
echo "$KPI" > "kpis.txt"

161
utils/health/valgrind-tests.sh Executable file
View File

@@ -0,0 +1,161 @@
#!/bin/bash -e
# Copyright (c) 2014-2020, The Monero Project
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be
# used to endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# This script is able to run valgrind's callgrind, cachegrind and memcheck for a given set of executables.
# It expects ONE PARAMETER, which points to a file with paths to executables and their arguments, written line by line.
if [ "$#" -ne 1 ]; then
echo "Please provide an argument, which points to a file with paths to executables and their arguments, written line by line. For example:"
echo ""
echo "ls -l -h"
echo "build/tests/unit_tests/unit_tests"
exit 1
fi
FILE_IN="$1"
DIR_OUT="build/valgrind-output" # Using build as the base output directory, as it's ignored in .gitignore
function is_file_or_exit {
FILE="${1}"
if [ -f $FILE ]; then
echo "The input file $FILE exists. Can proceed."
else
echo "The input file $FILE doesn't exist."
exit 1
fi
return 0
}
function is_tool_or_exit {
TOOL="${1}"
if $(hash ${TOOL}); then
echo "${TOOL} is installed. Can proceed."
else
echo "Please install ${TOOL} to continue."
exit 1
fi
return 0
}
function get_tool_out_file_base {
EXE="${1}"
TOOL="${2}"
EXE_NAME=$(basename $EXE)
local retval="${DIR_OUT}/${EXE_NAME}-${TOOL}"
echo "$retval"
}
function get_tool_out_file {
EXE="${1}"
TOOL="${2}"
FILE_OUT_BASE=$(get_tool_out_file_base ${EXE} ${TOOL})
local retval="--${TOOL}-out-file=${FILE_OUT_BASE}.out"
echo "$retval"
}
function run_valgrind_4_executable {
EXE="${1}"
ARGS="${2}"
TOOL="${3}"
EXTRA_OPTS="${4}"
FILE_OUT_TOOL="${5}"
FILE_OUT_BASE=$(get_tool_out_file_base ${EXE} ${TOOL})
echo "Runnig '${TOOL}' for '${EXE}' with args '${ARGS}'"
echo "EXTRA_OPTS = ${EXTRA_OPTS}"
echo "FILE_OUT_TOOL = ${FILE_OUT_TOOL}"
if ! valgrind --tool=${TOOL} ${FILE_OUT_TOOL} --log-file="${FILE_OUT_BASE}.log" ${EXTRA_OPTS} ${EXE} ${ARGS}; then
echo "FAILED in runnig ${TOOL} for ${EXE} !"
fi
}
function run_valgrind_4_executable_callgrind {
EXE="${1}"
ARGS="${2}"
TOOL="callgrind"
EXTRA_OPTS="--dump-instr=yes --simulate-cache=yes --collect-jumps=yes"
FILE_OUT_TOOL=$(get_tool_out_file ${EXE} ${TOOL})
run_valgrind_4_executable ${EXE} "${ARGS}" ${TOOL} "${EXTRA_OPTS}" ${FILE_OUT_TOOL}
}
function run_valgrind_4_executable_cachegrind {
EXE="${1}"
ARGS="${2}"
TOOL="cachegrind"
EXTRA_OPTS=""
FILE_OUT_TOOL=$(get_tool_out_file ${EXE} ${TOOL})
run_valgrind_4_executable ${EXE} "${ARGS}" ${TOOL} "${EXTRA_OPTS}" ${FILE_OUT_TOOL}
}
function run_valgrind_4_executable_memcheck {
EXE="${1}"
ARGS="${2}"
TOOL="memcheck"
#EXTRA_OPTS="--leak-check=yes" # Minimalistic
EXTRA_OPTS="--leak-check=full --show-leak-kinds=all --track-origins=yes"
FILE_OUT_TOOL="" # memcheck has no special out file, only the log
run_valgrind_4_executable ${EXE} "${ARGS}" ${TOOL} "${EXTRA_OPTS}" ${FILE_OUT_TOOL}
}
function run_valgrind_4_executable_all {
EXE_ARGS_ARR=(${1})
EXE=${EXE_ARGS_ARR[0]} # First element of the array
ARGS=${EXE_ARGS_ARR[@]:1} # Every next element
#EXE="ls" # A quick check of the happy path
#EXE="nothere" # A quick check of error handling - no such executable
#EXE=/bin/false # A quick check of error handling - executable returned != 0
run_valgrind_4_executable_memcheck ${EXE} "${ARGS}"
run_valgrind_4_executable_cachegrind ${EXE} "${ARGS}"
run_valgrind_4_executable_callgrind ${EXE} "${ARGS}"
}
is_tool_or_exit valgrind
is_file_or_exit "$FILE_IN"
echo "All OK."
echo "Will perform checks for the following executables and their arguments:"
while IFS= read -r line; do
echo "$line"
done < "$FILE_IN"
mkdir -p "$DIR_OUT"
while IFS= read -r line; do
echo "$line"
run_valgrind_4_executable_all "$line"
done < "$FILE_IN"
echo "Done. All data saved in ${DIR_OUT}"