Compare commits

...

13 Commits

Author SHA1 Message Date
luigi1111
7bd1ed03dd Merge pull request #6737
0325474 epee: further defending against exceptions in command handlers (moneromooo-monero)
2020-08-03 08:45:47 -05:00
luigi1111
9006119fba Merge pull request #6734
3aae649 Tweak format, add option for difficulty (hyc)
e416f56 Add options to print daily coin emission and fees (hyc)
2f481da Don't forget size of prunable txn part (hyc)
2020-08-03 08:43:09 -05:00
Howard Chu
3aae649738 Tweak format, add option for difficulty
Set input, output, ringsize averages to 2 decimal places precision
Add option to show min/max/av per-block difficulty
2020-08-02 18:31:22 +01:00
moneromooo-monero
03254742e5 epee: further defending against exceptions in command handlers 2020-08-02 00:23:13 +00:00
Howard Chu
e416f56f31 Add options to print daily coin emission and fees
Closes #6735
2020-08-01 20:49:48 +01:00
Howard Chu
2f481da900 Don't forget size of prunable txn part
Fixes #6732
2020-08-01 17:14:29 +01:00
luigi1111
c9aad8a38b Merge pull request #6729
f370093 build: prepare v0.16.0.3 release (selsta)
2020-07-31 15:06:09 -05:00
luigi1111
7f8fe816f4 Merge pull request #6728
870a7b5 rpc: reject wrong sized txid (moneromooo-monero)
5b761d0 easylogging++: fix crash with reentrant logging (moneromooo-monero)
c02d762 epee: guard against exceptions in RPC handlers (moneromooo-monero)
0678fc1 blockchain: guard against exceptions in add_new_block/children (moneromooo-monero)
2020-07-31 15:05:03 -05:00
moneromooo-monero
870a7b5201 rpc: reject wrong sized txid
Reporter requested credit to be given to Decred
2020-07-30 22:51:57 +00:00
moneromooo-monero
5b761d0186 easylogging++: fix crash with reentrant logging 2020-07-30 22:51:56 +00:00
moneromooo-monero
c02d7621a4 epee: guard against exceptions in RPC handlers 2020-07-30 22:51:56 +00:00
moneromooo-monero
0678fc1f97 blockchain: guard against exceptions in add_new_block/children
Reporter requested credit to be given to Decred
2020-07-30 22:51:51 +00:00
selsta
f37009364a build: prepare v0.16.0.3 release 2020-07-30 16:01:21 +02:00
11 changed files with 143 additions and 34 deletions

View File

@@ -132,7 +132,7 @@ Dates are provided in the format YYYY-MM-DD.
| 1686275 | 2018-10-19 | v9 | v0.13.0.0 | v0.13.0.4 | bulletproofs required
| 1788000 | 2019-03-09 | v10 | v0.14.0.0 | v0.14.1.2 | New PoW based on Cryptonight-R, new block weight algorithm, slightly more efficient RingCT format
| 1788720 | 2019-03-10 | v11 | v0.14.0.0 | v0.14.1.2 | forbid old RingCT transaction format
| 1978433 | 2019-11-30* | v12 | v0.15.0.0 | v0.16.0.1 | New PoW based on RandomX, only allow >= 2 outputs, change to the block median used to calculate penalty, v1 coinbases are forbidden, rct sigs in coinbase forbidden, 10 block lock time for incoming outputs
| 1978433 | 2019-11-30* | v12 | v0.15.0.0 | v0.16.0.3 | New PoW based on RandomX, only allow >= 2 outputs, change to the block median used to calculate penalty, v1 coinbases are forbidden, rct sigs in coinbase forbidden, 10 block lock time for incoming outputs
| XXXXXXX | XXX-XX-XX | XXX | vX.XX.X.X | vX.XX.X.X | XXX |
X's indicate that these details have not been determined as of commit date.
@@ -292,7 +292,7 @@ Tested on a Raspberry Pi Zero with a clean install of minimal Raspbian Stretch (
```bash
git clone https://github.com/monero-project/monero.git
cd monero
git checkout tags/v0.16.0.1
git checkout tags/v0.16.0.3
```
* Build:
@@ -409,10 +409,10 @@ application.
cd monero
```
* If you would like a specific [version/tag](https://github.com/monero-project/monero/tags), do a git checkout for that version. eg. 'v0.16.0.1'. If you don't care about the version and just want binaries from master, skip this step:
* If you would like a specific [version/tag](https://github.com/monero-project/monero/tags), do a git checkout for that version. eg. 'v0.16.0.3'. If you don't care about the version and just want binaries from master, skip this step:
```bash
git checkout v0.16.0.1
git checkout v0.16.0.3
```
* If you are on a 64-bit system, run:

View File

@@ -42,8 +42,17 @@
MINFO("HTTP [" << m_conn_context.m_remote_address.host_str() << "] " << query_info.m_http_method_str << " " << query_info.m_URI); \
response.m_response_code = 200; \
response.m_response_comment = "Ok"; \
if(!handle_http_request_map(query_info, response, m_conn_context)) \
{response.m_response_code = 404;response.m_response_comment = "Not found";} \
try \
{ \
if(!handle_http_request_map(query_info, response, m_conn_context)) \
{response.m_response_code = 404;response.m_response_comment = "Not found";} \
} \
catch (const std::exception &e) \
{ \
MERROR(m_conn_context << "Exception in handle_http_request_map: " << e.what()); \
response.m_response_code = 500; \
response.m_response_comment = "Internal Server Error"; \
} \
return true; \
}
@@ -69,9 +78,11 @@
uint64_t ticks1 = epee::misc_utils::get_tick_count(); \
boost::value_initialized<command_type::response> resp;\
MINFO(m_conn_context << "calling " << s_pattern); \
if(!callback_f(static_cast<command_type::request&>(req), static_cast<command_type::response&>(resp), &m_conn_context)) \
bool res = false; \
try { res = callback_f(static_cast<command_type::request&>(req), static_cast<command_type::response&>(resp), &m_conn_context); } \
catch (const std::exception &e) { MERROR(m_conn_context << "Failed to " << #callback_f << "(): " << e.what()); } \
if (!res) \
{ \
MERROR(m_conn_context << "Failed to " << #callback_f << "()"); \
response_info.m_response_code = 500; \
response_info.m_response_comment = "Internal Server Error"; \
return true; \
@@ -97,9 +108,11 @@
uint64_t ticks1 = misc_utils::get_tick_count(); \
boost::value_initialized<command_type::response> resp;\
MINFO(m_conn_context << "calling " << s_pattern); \
if(!callback_f(static_cast<command_type::request&>(req), static_cast<command_type::response&>(resp), &m_conn_context)) \
bool res = false; \
try { res = callback_f(static_cast<command_type::request&>(req), static_cast<command_type::response&>(resp), &m_conn_context); } \
catch (const std::exception &e) { MERROR(m_conn_context << "Failed to " << #callback_f << "()"); } \
if (!res) \
{ \
MERROR(m_conn_context << "Failed to " << #callback_f << "()"); \
response_info.m_response_code = 500; \
response_info.m_response_comment = "Internal Server Error"; \
return true; \
@@ -184,7 +197,10 @@
fail_resp.jsonrpc = "2.0"; \
fail_resp.id = req.id; \
MINFO(m_conn_context << "Calling RPC method " << method_name); \
if(!callback_f(req.params, resp.result, fail_resp.error, &m_conn_context)) \
bool res = false; \
try { res = callback_f(req.params, resp.result, fail_resp.error, &m_conn_context); } \
catch (const std::exception &e) { MERROR(m_conn_context << "Failed to " << #callback_f << "(): " << e.what()); } \
if (!res) \
{ \
epee::serialization::store_t_to_json(static_cast<epee::json_rpc::error_response&>(fail_resp), response_info.m_body); \
return true; \
@@ -203,7 +219,10 @@
fail_resp.jsonrpc = "2.0"; \
fail_resp.id = req.id; \
MINFO(m_conn_context << "calling RPC method " << method_name); \
if(!callback_f(req.params, resp.result, fail_resp.error, response_info, &m_conn_context)) \
bool res = false; \
try { res = callback_f(req.params, resp.result, fail_resp.error, response_info, &m_conn_context); } \
catch (const std::exception &e) { MERROR(m_conn_context << "Failed to " << #callback_f << "(): " << e.what()); } \
if (!res) \
{ \
epee::serialization::store_t_to_json(static_cast<epee::json_rpc::error_response&>(fail_resp), response_info.m_body); \
return true; \
@@ -217,7 +236,10 @@
{ \
PREPARE_OBJECTS_FROM_JSON(command_type) \
MINFO(m_conn_context << "calling RPC method " << method_name); \
if(!callback_f(req.params, resp.result, &m_conn_context)) \
bool res = false; \
try { res = callback_f(req.params, resp.result, &m_conn_context); } \
catch (const std::exception &e) { MERROR(m_conn_context << "Failed to " << #callback_f << "(): " << e.what()); } \
if (!res) \
{ \
epee::json_rpc::error_response fail_resp = AUTO_VAL_INIT(fail_resp); \
fail_resp.jsonrpc = "2.0"; \

View File

@@ -290,6 +290,7 @@ namespace epee
#define BEGIN_INVOKE_MAP2(owner_type) \
template <class t_context> int handle_invoke_map(bool is_notify, int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, t_context& context, bool& handled) \
{ \
try { \
typedef owner_type internal_owner_type_name;
#define HANDLE_INVOKE2(command_id, func, type_name_in, typename_out) \
@@ -335,7 +336,13 @@ namespace epee
LOG_ERROR("Unknown command:" << command); \
on_levin_traffic(context, false, false, true, in_buff.size(), "invalid-command"); \
return LEVIN_ERROR_CONNECTION_HANDLER_NOT_DEFINED; \
} \
catch (const std::exception &e) { \
MERROR("Error in handle_invoke_map: " << e.what()); \
return LEVIN_ERROR_CONNECTION_TIMEDOUT; /* seems kinda appropriate */ \
} \
}
}
}

View File

@@ -126,7 +126,7 @@ Setup for LXC:
```bash
GH_USER=fluffypony
VERSION=v0.16.0.1
VERSION=v0.16.0.3
./gitian-build.py --setup $GH_USER $VERSION
```
@@ -182,7 +182,7 @@ If you chose to do detached signing using `--detach-sign` above (recommended), y
```bash
GH_USER=fluffypony
VERSION=v0.16.0.1
VERSION=v0.16.0.3
gpg --detach-sign ${VERSION}-linux/${GH_USER}/monero-linux-*-build.assert
gpg --detach-sign ${VERSION}-win/${GH_USER}/monero-win-*-build.assert

View File

@@ -2968,6 +2968,16 @@ void Writer::initializeLogger(Logger *logger, bool needLock) {
}
void Writer::processDispatch() {
static std::atomic_flag in_dispatch;
if (in_dispatch.test_and_set())
{
if (m_proceed && m_logger != NULL)
{
m_logger->stream().str(ELPP_LITERAL(""));
m_logger->releaseLock();
}
return;
}
#if ELPP_LOGGING_ENABLED
if (ELPP->hasFlag(LoggingFlag::MultiLoggerSupport)) {
bool firstDispatched = false;
@@ -3006,6 +3016,7 @@ void Writer::processDispatch() {
m_logger->releaseLock();
}
#endif // ELPP_LOGGING_ENABLED
in_dispatch.clear();
}
void Writer::triggerDispatch(void) {

View File

@@ -68,6 +68,9 @@ int main(int argc, char* argv[])
const command_line::arg_descriptor<bool> arg_outputs = {"with-outputs", "with output stats", false};
const command_line::arg_descriptor<bool> arg_ringsize = {"with-ringsize", "with ringsize stats", false};
const command_line::arg_descriptor<bool> arg_hours = {"with-hours", "with txns per hour", false};
const command_line::arg_descriptor<bool> arg_emission = {"with-emission", "with coin emission", false};
const command_line::arg_descriptor<bool> arg_fees = {"with-fees", "with txn fees", false};
const command_line::arg_descriptor<bool> arg_diff = {"with-diff", "with difficulty", false};
command_line::add_arg(desc_cmd_sett, cryptonote::arg_data_dir);
command_line::add_arg(desc_cmd_sett, cryptonote::arg_testnet_on);
@@ -79,6 +82,9 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_cmd_sett, arg_outputs);
command_line::add_arg(desc_cmd_sett, arg_ringsize);
command_line::add_arg(desc_cmd_sett, arg_hours);
command_line::add_arg(desc_cmd_sett, arg_emission);
command_line::add_arg(desc_cmd_sett, arg_fees);
command_line::add_arg(desc_cmd_sett, arg_diff);
command_line::add_arg(desc_cmd_only, command_line::arg_help);
po::options_description desc_options("Allowed options");
@@ -120,6 +126,9 @@ int main(int argc, char* argv[])
bool do_outputs = command_line::get_arg(vm, arg_outputs);
bool do_ringsize = command_line::get_arg(vm, arg_ringsize);
bool do_hours = command_line::get_arg(vm, arg_hours);
bool do_emission = command_line::get_arg(vm, arg_emission);
bool do_fees = command_line::get_arg(vm, arg_fees);
bool do_diff = command_line::get_arg(vm, arg_diff);
LOG_PRINT_L0("Initializing source blockchain (BlockchainDB)");
std::unique_ptr<Blockchain> core_storage;
@@ -177,12 +186,20 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, ''
// spit out a comment that GnuPlot can use as an index
std::cout << ENDL << "# DATA" << ENDL;
std::cout << "Date\tBlocks/day\tBlocks\tTxs/Day\tTxs\tBytes/Day\tBytes";
if (do_emission)
std::cout << "\tEmission/day\tEmission";
if (do_fees)
std::cout << "\tFees/day\tFees";
if (do_diff)
std::cout << "\tDiffMin\tDiffMax\tDiffAvg";
if (do_inputs)
std::cout << "\tInMin\tInMax\tInAvg";
if (do_outputs)
std::cout << "\tOutMin\tOutMax\tOutAvg";
if (do_ringsize)
std::cout << "\tRingMin\tRingMax\tRingAvg";
if (do_inputs || do_outputs || do_ringsize)
std::cout << std::setprecision(2) << std::fixed;
if (do_hours) {
char buf[8];
unsigned int i;
@@ -193,14 +210,20 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, ''
}
std::cout << ENDL;
#define MAX_INOUT 0xffffffff
#define MAX_RINGS 0xffffffff
struct tm prevtm = {0}, currtm;
uint64_t prevsz = 0, currsz = 0;
uint64_t prevtxs = 0, currtxs = 0;
uint64_t currblks = 0;
uint64_t totins = 0, totouts = 0, totrings = 0;
uint32_t minins = 10, maxins = 0;
uint32_t minouts = 10, maxouts = 0;
uint32_t minrings = 50, maxrings = 0;
boost::multiprecision::uint128_t prevemission = 0, prevfees = 0;
boost::multiprecision::uint128_t emission = 0, fees = 0;
boost::multiprecision::uint128_t totdiff = 0, mindiff = 0, maxdiff = 0;
uint32_t minins = MAX_INOUT, maxins = 0;
uint32_t minouts = MAX_INOUT, maxouts = 0;
uint32_t minrings = MAX_RINGS, maxrings = 0;
uint32_t io, tottxs = 0;
uint32_t txhr[24] = {0};
unsigned int i;
@@ -230,34 +253,50 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, ''
std::cout << timebuf << "\t" << currblks << "\t" << h << "\t" << currtxs << "\t" << prevtxs + currtxs << "\t" << currsz << "\t" << prevsz + currsz;
prevsz += currsz;
currsz = 0;
currblks = 0;
prevtxs += currtxs;
currtxs = 0;
if (!tottxs)
tottxs = 1;
if (do_emission) {
std::cout << "\t" << print_money(emission) << "\t" << print_money(prevemission + emission);
prevemission += emission;
emission = 0;
}
if (do_fees) {
std::cout << "\t" << print_money(fees) << "\t" << print_money(prevfees + fees);
prevfees += fees;
fees = 0;
}
if (do_diff) {
std::cout << "\t" << (maxdiff ? mindiff : 0) << "\t" << maxdiff << "\t" << totdiff / currblks;
mindiff = 0; maxdiff = 0; totdiff = 0;
}
if (do_inputs) {
std::cout << "\t" << (maxins ? minins : 0) << "\t" << maxins << "\t" << totins / tottxs;
minins = 10; maxins = 0; totins = 0;
std::cout << "\t" << (maxins ? minins : 0) << "\t" << maxins << "\t" << totins * 1.0 / tottxs;
minins = MAX_INOUT; maxins = 0; totins = 0;
}
if (do_outputs) {
std::cout << "\t" << (maxouts ? minouts : 0) << "\t" << maxouts << "\t" << totouts / tottxs;
minouts = 10; maxouts = 0; totouts = 0;
std::cout << "\t" << (maxouts ? minouts : 0) << "\t" << maxouts << "\t" << totouts * 1.0 / tottxs;
minouts = MAX_INOUT; maxouts = 0; totouts = 0;
}
if (do_ringsize) {
std::cout << "\t" << (maxrings ? minrings : 0) << "\t" << maxrings << "\t" << totrings / tottxs;
minrings = 50; maxrings = 0; totrings = 0;
std::cout << "\t" << (maxrings ? minrings : 0) << "\t" << maxrings << "\t" << totrings * 1.0 / tottxs;
minrings = MAX_RINGS; maxrings = 0; totrings = 0;
}
tottxs = 0;
if (do_hours) {
for (i=0; i<24; i++) {
std::cout << "\t" << txhr[i];
txhr[i] = 0;
}
}
currblks = 0;
tottxs = 0;
std::cout << ENDL;
}
skip:
currsz += bd.size();
uint64_t coinbase_amount;
uint64_t tx_fee_amount = 0;
for (const auto& tx_id : blk.tx_hashes)
{
if (tx_id == crypto::null_hash)
@@ -275,7 +314,12 @@ skip:
return 1;
}
currsz += bd.size();
if (db->get_prunable_tx_blob(tx_id, bd))
currsz += bd.size();
currtxs++;
if (do_fees || do_emission) {
tx_fee_amount += get_tx_fee(tx);
}
if (do_hours)
txhr[currtm.tm_hour]++;
if (do_inputs) {
@@ -306,6 +350,21 @@ skip:
}
tottxs++;
}
if (do_diff) {
difficulty_type diff = db->get_block_difficulty(h);
if (!mindiff || diff < mindiff)
mindiff = diff;
if (diff > maxdiff)
maxdiff = diff;
totdiff += diff;
}
if (do_emission) {
coinbase_amount = get_outs_money_amount(blk.miner_tx);
emission += coinbase_amount - tx_fee_amount;
}
if (do_fees) {
fees += tx_fee_amount;
}
currblks++;
if (stop_requested)

Binary file not shown.

View File

@@ -214,6 +214,7 @@ namespace cryptonote
ADD_CHECKPOINT(2046000, "5e867f0b8baefed9244a681df97fc885d8ab36c3dfcd24c7a3abf3b8ac8b8314");
ADD_CHECKPOINT(2092500, "c4e00820c9c7989b49153d5e90ae095a18a11d990e82fcc3be54e6ed785472b5");
ADD_CHECKPOINT(2125000, "a8e49c62792a2aa56ba62603fe015303647e2c19203c56999c7f6f2498cd3e6d");
ADD_CHECKPOINT(2153000, "05952ed32f92647c44f91b222cc95cc8fb6f04cefd59b76ef30884fec957797e");
return true;
}

View File

@@ -4253,6 +4253,9 @@ bool Blockchain::update_next_cumulative_weight_limit(uint64_t *long_term_effecti
//------------------------------------------------------------------
bool Blockchain::add_new_block(const block& bl, block_verification_context& bvc)
{
try
{
LOG_PRINT_L3("Blockchain::" << __func__);
crypto::hash id = get_block_hash(bl);
CRITICAL_REGION_LOCAL(m_tx_pool);//to avoid deadlock lets lock tx_pool for whole add/reorganize process
@@ -4280,6 +4283,14 @@ bool Blockchain::add_new_block(const block& bl, block_verification_context& bvc)
rtxn_guard.stop();
return handle_block_to_main_chain(bl, id, bvc);
}
catch (const std::exception &e)
{
LOG_ERROR("Exception at [add_new_block], what=" << e.what());
bvc.m_verifivation_failed = true;
return false;
}
}
//------------------------------------------------------------------
//TODO: Refactor, consider returning a failure height and letting
@@ -5111,7 +5122,7 @@ void Blockchain::cancel()
}
#if defined(PER_BLOCK_CHECKPOINT)
static const char expected_block_hashes_hash[] = "da1cafd8f186d06c2985ca84cab7980d276538ac86086a38f25514a52e5b09b4";
static const char expected_block_hashes_hash[] = "37e15136d7527e47940ef85bff9d258b940c583bcc2e820aa9a98833a7344ece";
void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get_checkpoints)
{
if (get_checkpoints == nullptr || !m_fast_sync)

View File

@@ -2453,14 +2453,13 @@ namespace cryptonote
{
for (const auto &str: req.txids)
{
cryptonote::blobdata txid_data;
if(!epee::string_tools::parse_hexstr_to_binbuff(str, txid_data))
crypto::hash txid;
if(!epee::string_tools::hex_to_pod(str, txid))
{
failed = true;
}
else
{
crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_data.data());
txids.push_back(txid);
}
}
@@ -2805,15 +2804,14 @@ namespace cryptonote
res.status = "";
for (const auto &str: req.txids)
{
cryptonote::blobdata txid_data;
if(!epee::string_tools::parse_hexstr_to_binbuff(str, txid_data))
crypto::hash txid;
if(!epee::string_tools::hex_to_pod(str, txid))
{
if (!res.status.empty()) res.status += ", ";
res.status += std::string("invalid transaction id: ") + str;
failed = true;
continue;
}
crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_data.data());
cryptonote::blobdata txblob;
if (m_core.get_pool_transaction(txid, txblob, relay_category::legacy))

View File

@@ -1,5 +1,5 @@
#define DEF_MONERO_VERSION_TAG "@VERSIONTAG@"
#define DEF_MONERO_VERSION "0.16.0.1"
#define DEF_MONERO_VERSION "0.16.0.3"
#define DEF_MONERO_RELEASE_NAME "Nitrogen Nebula"
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
#define DEF_MONERO_VERSION_IS_RELEASE @VERSION_IS_RELEASE@