diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 850dbdc9a..4c1e381c0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -151,7 +151,7 @@ jobs: - name: install monero dependencies run: ${{env.APT_INSTALL_LINUX}} - name: install Python dependencies - run: pip install requests psutil monotonic zmq + run: pip install requests psutil monotonic zmq deepdiff - name: tests env: CTEST_OUTPUT_ON_FAILURE: ON diff --git a/Makefile b/Makefile index a07ac77a1..a3b8f46f2 100644 --- a/Makefile +++ b/Makefile @@ -104,7 +104,7 @@ release-all: release-static: mkdir -p $(builddir)/release - cd $(builddir)/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release $(topdir) && $(MAKE) + cd $(builddir)/release && cmake -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release $(topdir) && $(MAKE) coverage: mkdir -p $(builddir)/debug diff --git a/README.md b/README.md index 9acea573a..665c2dd8c 100644 --- a/README.md +++ b/README.md @@ -138,8 +138,8 @@ Dates are provided in the format YYYY-MM-DD. | 1978433 | 2019-11-30 | v12 | v0.15.0.0 | v0.16.0.0 | 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 | 2210000 | 2020-10-17 | v13 | v0.17.0.0 | v0.17.3.2 | New CLSAG transaction format | 2210720 | 2020-10-18 | v14 | v0.17.1.1 | v0.17.3.2 | forbid old MLSAG transaction format -| 2688888 | 2022-08-13 | v15 | v0.18.0.0 | v0.18.2.2 | ringsize = 16, bulletproofs+, view tags, adjusted dynamic block weight algorithm -| 2689608 | 2022-08-14 | v16 | v0.18.0.0 | v0.18.2.2 | forbid old v14 transaction format +| 2688888 | 2022-08-13 | v15 | v0.18.0.0 | v0.18.3.2 | ringsize = 16, bulletproofs+, view tags, adjusted dynamic block weight algorithm +| 2689608 | 2022-08-14 | v16 | v0.18.0.0 | v0.18.3.2 | forbid old v14 transaction format | 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. @@ -344,7 +344,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 v0.18.2.2 + git checkout v0.18.3.2 ``` * Build: @@ -463,10 +463,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.18.2.2'. 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.18.3.2'. If you don't care about the version and just want binaries from master, skip this step: ```bash - git checkout v0.18.2.2 + git checkout v0.18.3.2 ``` * If you are on a 64-bit system, run: diff --git a/contrib/depends/funcs.mk b/contrib/depends/funcs.mk index 66555aad7..e08669c98 100644 --- a/contrib/depends/funcs.mk +++ b/contrib/depends/funcs.mk @@ -145,7 +145,7 @@ $(1)_build_env+=PATH="$(build_prefix)/bin:$(PATH)" $(1)_stage_env+=PATH="$(build_prefix)/bin:$(PATH)" $(1)_autoconf=./configure --host=$($($(1)_type)_host) --prefix=$($($(1)_type)_prefix) $$($(1)_config_opts) CC="$$($(1)_cc)" CXX="$$($(1)_cxx)" -ifneq ($(1),libusb) +ifeq ($(filter $(1),libusb unbound),) $(1)_autoconf += --disable-dependency-tracking endif ifneq ($($(1)_nm),) diff --git a/contrib/depends/packages/expat.mk b/contrib/depends/packages/expat.mk index 9516f86ab..590245179 100644 --- a/contrib/depends/packages/expat.mk +++ b/contrib/depends/packages/expat.mk @@ -1,12 +1,12 @@ package=expat -$(package)_version=2.4.1 -$(package)_download_path=https://github.com/libexpat/libexpat/releases/download/R_2_4_1 +$(package)_version=2.6.0 +$(package)_download_path=https://github.com/libexpat/libexpat/releases/download/R_$(subst .,_,$($(package)_version))/ $(package)_file_name=$(package)-$($(package)_version).tar.bz2 -$(package)_sha256_hash=2f9b6a580b94577b150a7d5617ad4643a4301a6616ff459307df3e225bcfbf40 +$(package)_sha256_hash=ff60e6a6b6ce570ae012dc7b73169c7fdf4b6bf08c12ed0ec6f55736b78d85ba define $(package)_set_vars -$(package)_config_opts=--enable-static -$(package)_config_opts=--disable-shared +$(package)_config_opts=--disable-shared --without-docbook --without-tests --without-examples +$(package)_config_opts+=--enable-option-checking --without-xmlwf --with-pic $(package)_config_opts+=--prefix=$(host_prefix) endef @@ -23,6 +23,6 @@ define $(package)_stage_cmds endef define $(package)_postprocess_cmds - rm lib/*.la + rm -rf share lib/cmake lib/*.la endef diff --git a/contrib/depends/packages/openssl.mk b/contrib/depends/packages/openssl.mk index 990b85093..a157762c7 100644 --- a/contrib/depends/packages/openssl.mk +++ b/contrib/depends/packages/openssl.mk @@ -1,20 +1,19 @@ package=openssl -$(package)_version=1.1.1t +$(package)_version=3.0.13 $(package)_download_path=https://www.openssl.org/source $(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=8dee9b24bdb1dcbf0c3d1e9b02fb8f6bf22165e807f45adeb7c9677536859d3b +$(package)_sha256_hash=88525753f79d3bec27d2fa7c66aa0b92b3aa9498dafd93d7cfa4b3780cdae313 define $(package)_set_vars $(package)_config_env=AR="$($(package)_ar)" ARFLAGS=$($(package)_arflags) RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)" -$(package)_config_env_android=ANDROID_NDK_HOME="$(host_prefix)/native" PATH="$(host_prefix)/native/bin" CC=clang AR=ar RANLIB=ranlib -$(package)_build_env_android=ANDROID_NDK_HOME="$(host_prefix)/native" -$(package)_config_opts=--prefix=$(host_prefix) --openssldir=$(host_prefix)/etc/openssl +$(package)_config_env_android=ANDROID_NDK_ROOT="$(host_prefix)/native" PATH="$(host_prefix)/native/bin" CC=clang AR=ar RANLIB=ranlib +$(package)_build_env_android=ANDROID_NDK_ROOT="$(host_prefix)/native" +$(package)_config_opts=--prefix=$(host_prefix) --openssldir=$(host_prefix)/etc/openssl --libdir=$(host_prefix)/lib $(package)_config_opts+=no-capieng $(package)_config_opts+=no-dso $(package)_config_opts+=no-dtls1 $(package)_config_opts+=no-ec_nistp_64_gcc_128 $(package)_config_opts+=no-gost -$(package)_config_opts+=no-heartbeats $(package)_config_opts+=no-md2 $(package)_config_opts+=no-rc5 $(package)_config_opts+=no-rdrand @@ -22,8 +21,8 @@ $(package)_config_opts+=no-rfc3779 $(package)_config_opts+=no-sctp $(package)_config_opts+=no-shared $(package)_config_opts+=no-ssl-trace -$(package)_config_opts+=no-ssl2 $(package)_config_opts+=no-ssl3 +$(package)_config_opts+=no-tests $(package)_config_opts+=no-unit-test $(package)_config_opts+=no-weak-ssl-ciphers $(package)_config_opts+=no-zlib @@ -49,7 +48,7 @@ $(package)_config_opts_x86_64_freebsd=BSD-x86_64 endef define $(package)_preprocess_cmds - sed -i.old 's|"engines", "apps", "test", "util", "tools", "fuzz"|"engines", "tools"|' Configure + sed -i.old 's|crypto ssl apps util tools fuzz providers doc|crypto ssl util tools providers|' build.info endef define $(package)_config_cmds diff --git a/contrib/depends/packages/unbound.mk b/contrib/depends/packages/unbound.mk index 421c51f7f..d9ef0076a 100644 --- a/contrib/depends/packages/unbound.mk +++ b/contrib/depends/packages/unbound.mk @@ -1,17 +1,21 @@ package=unbound -$(package)_version=1.15.0 +$(package)_version=1.19.1 $(package)_download_path=https://www.nlnetlabs.nl/downloads/$(package)/ $(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=a480dc6c8937447b98d161fe911ffc76cfaffa2da18788781314e81339f1126f +$(package)_sha256_hash=bc1d576f3dd846a0739adc41ffaa702404c6767d2b6082deb9f2f97cbb24a3a9 $(package)_dependencies=openssl expat $(package)_patches=disable-glibc-reallocarray.patch define $(package)_set_vars - $(package)_config_opts=--disable-shared --enable-static --without-pyunbound --prefix=$(host_prefix) --with-libexpat=$(host_prefix) --with-ssl=$(host_prefix) --with-libevent=no --without-pythonmodule --disable-flto --with-pthreads --with-libunbound-only + $(package)_config_opts=--disable-shared --enable-static --without-pyunbound --prefix=$(host_prefix) + $(package)_config_opts+=--with-libexpat=$(host_prefix) --with-ssl=$(host_prefix) --with-libevent=no + $(package)_config_opts+=--without-pythonmodule --disable-flto --with-pthreads --with-libunbound-only $(package)_config_opts_linux=--with-pic $(package)_config_opts_w64=--enable-static-exe --sysconfdir=/etc --prefix=$(host_prefix) --target=$(host_prefix) + $(package)_config_opts_x86_64_darwin=ac_cv_func_SHA384_Init=yes $(package)_build_opts_mingw32=LDFLAGS="$($(package)_ldflags) -lpthread" + $(package)_cflags_mingw32+="-D_WIN32_WINNT=0x600" endef define $(package)_preprocess_cmds @@ -30,6 +34,3 @@ endef define $(package)_stage_cmds $(MAKE) DESTDIR=$($(package)_staging_dir) install endef - -define $(package)_postprocess_cmds -endef diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in index 570065560..c86012a6a 100644 --- a/contrib/depends/toolchain.cmake.in +++ b/contrib/depends/toolchain.cmake.in @@ -144,8 +144,8 @@ elseif(ARCHITECTURE STREQUAL "aarch64") endif() if(ARCHITECTURE STREQUAL "riscv64") - set(NO_AES ON) - set(ARCH "rv64imafdc") + set(ARCH_ID "riscv64") + set(ARCH "rv64gc") endif() if(ARCHITECTURE STREQUAL "i686") diff --git a/contrib/epee/include/file_io_utils.h b/contrib/epee/include/file_io_utils.h index da05520c1..de95e58c3 100644 --- a/contrib/epee/include/file_io_utils.h +++ b/contrib/epee/include/file_io_utils.h @@ -29,6 +29,7 @@ #include #include +#include namespace epee { diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 81aa725d1..d88f18194 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -583,11 +583,8 @@ namespace net_utils break; } } - else if (ec.value()) - terminate(); else { - cancel_timer(); - on_interrupted(); + terminate(); } }; m_strand.post( diff --git a/contrib/epee/include/net/http_client.h b/contrib/epee/include/net/http_client.h index 9ce30b620..af1aee9f6 100644 --- a/contrib/epee/include/net/http_client.h +++ b/contrib/epee/include/net/http_client.h @@ -245,8 +245,18 @@ namespace net_utils } } + // This magic var determines the maximum length for when copying the body message in + // memory is faster/more preferable than the round-trip time for one packet + constexpr size_t BODY_NO_COPY_CUTOFF = 128 * 1024; // ~262 KB or ~175 packets + + // Maximum expected total headers bytes + constexpr size_t HEADER_RESERVE_SIZE = 2048; + + const bool do_copy_body = body.size() <= BODY_NO_COPY_CUTOFF; + const size_t req_buff_cap = HEADER_RESERVE_SIZE + (do_copy_body ? body.size() : 0); + std::string req_buff{}; - req_buff.reserve(2048); + req_buff.reserve(req_buff_cap); req_buff.append(method.data(), method.size()).append(" ").append(uri.data(), uri.size()).append(" HTTP/1.1\r\n"); add_field(req_buff, "Host", m_host_buff); add_field(req_buff, "Content-Length", std::to_string(body.size())); @@ -255,9 +265,7 @@ namespace net_utils for(const auto& field : additional_params) add_field(req_buff, field); - for (unsigned sends = 0; sends < 2; ++sends) { - const std::size_t initial_size = req_buff.size(); const auto auth = m_auth.get_auth_field(method, uri); if (auth) add_field(req_buff, *auth); @@ -265,11 +273,21 @@ namespace net_utils req_buff += "\r\n"; //-- - bool res = m_net_client.send(req_buff, timeout); - CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND"); - if(body.size()) + if (do_copy_body) // small body + { + // Copy headers + body together and potentially send one fewer packet + req_buff.append(body.data(), body.size()); + const bool res = m_net_client.send(req_buff, timeout); + CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND"); + } + else // large body + { + // Send headers and body seperately to avoid copying heavy body message + bool res = m_net_client.send(req_buff, timeout); + CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND"); res = m_net_client.send(body, timeout); - CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND"); + CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND"); + } m_response_info.clear(); m_state = reciev_machine_state_header; @@ -282,19 +300,11 @@ namespace net_utils return true; } - switch (m_auth.handle_401(m_response_info)) + if (m_auth.handle_401(m_response_info) == http_client_auth::kParseFailure) { - case http_client_auth::kSuccess: - break; - case http_client_auth::kBadPassword: - sends = 2; - break; - default: - case http_client_auth::kParseFailure: LOG_ERROR("Bad server response for authentication"); return false; } - req_buff.resize(initial_size); // rollback for new auth generation } LOG_ERROR("Client has incorrect username/password for server requiring authentication"); return false; diff --git a/contrib/epee/include/span.h b/contrib/epee/include/span.h index 99c2ebb4f..23bd51f8c 100644 --- a/contrib/epee/include/span.h +++ b/contrib/epee/include/span.h @@ -147,6 +147,16 @@ namespace epee return {reinterpret_cast(src.data()), src.size_bytes()}; } + //! \return `span` from a STL compatible `src`. + template + constexpr span to_mut_byte_span(T& src) + { + using value_type = typename T::value_type; + static_assert(!std::is_empty(), "empty value types will not work -> sizeof == 1"); + static_assert(!has_padding(), "source value type may have padding"); + return {reinterpret_cast(src.data()), src.size() * sizeof(value_type)}; + } + //! \return `span` which represents the bytes at `&src`. template span as_byte_span(const T& src) noexcept diff --git a/contrib/epee/include/storages/parserse_base_utils.h b/contrib/epee/include/storages/parserse_base_utils.h index 898813ff9..4658eba77 100644 --- a/contrib/epee/include/storages/parserse_base_utils.h +++ b/contrib/epee/include/storages/parserse_base_utils.h @@ -30,6 +30,7 @@ #include #include +#include namespace epee { diff --git a/contrib/epee/include/storages/portable_storage_from_bin.h b/contrib/epee/include/storages/portable_storage_from_bin.h index d8a8a4a49..b0af022f5 100644 --- a/contrib/epee/include/storages/portable_storage_from_bin.h +++ b/contrib/epee/include/storages/portable_storage_from_bin.h @@ -33,6 +33,9 @@ #include "portable_storage_base.h" #include "portable_storage_bin_utils.h" +#undef MONERO_DEFAULT_LOG_CATEGORY +#define MONERO_DEFAULT_LOG_CATEGORY "serialization" + #ifdef EPEE_PORTABLE_STORAGE_RECURSION_LIMIT #define EPEE_PORTABLE_STORAGE_RECURSION_LIMIT_INTERNAL EPEE_PORTABLE_STORAGE_RECURSION_LIMIT #else diff --git a/contrib/epee/include/storages/portable_storage_from_json.h b/contrib/epee/include/storages/portable_storage_from_json.h index 69192ca6b..f21a89a92 100644 --- a/contrib/epee/include/storages/portable_storage_from_json.h +++ b/contrib/epee/include/storages/portable_storage_from_json.h @@ -31,6 +31,9 @@ #include "parserse_base_utils.h" #include "file_io_utils.h" +#undef MONERO_DEFAULT_LOG_CATEGORY +#define MONERO_DEFAULT_LOG_CATEGORY "serialization" + #define EPEE_JSON_RECURSION_LIMIT_INTERNAL 100 namespace epee diff --git a/contrib/epee/src/mlog.cpp b/contrib/epee/src/mlog.cpp index 092d41777..4ca1a3632 100644 --- a/contrib/epee/src/mlog.cpp +++ b/contrib/epee/src/mlog.cpp @@ -338,11 +338,21 @@ bool is_stdout_a_tty() return is_a_tty.load(std::memory_order_relaxed); } +static bool is_nocolor() +{ + static const char *no_color_var = getenv("NO_COLOR"); + static const bool no_color = no_color_var && *no_color_var; // apparently, NO_COLOR=0 means no color too (as per no-color.org) + return no_color; +} + void set_console_color(int color, bool bright) { if (!is_stdout_a_tty()) return; + if (is_nocolor()) + return; + switch(color) { case console_color_default: @@ -461,6 +471,9 @@ void reset_console_color() { if (!is_stdout_a_tty()) return; + if (is_nocolor()) + return; + #ifdef WIN32 HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(h_stdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); diff --git a/contrib/epee/src/net_ssl.cpp b/contrib/epee/src/net_ssl.cpp index 2d0b7d791..9200796a8 100644 --- a/contrib/epee/src/net_ssl.cpp +++ b/contrib/epee/src/net_ssl.cpp @@ -496,6 +496,13 @@ void ssl_options_t::configure( const std::string& host) const { socket.next_layer().set_option(boost::asio::ip::tcp::no_delay(true)); + { + // in case server is doing "virtual" domains, set hostname + SSL* const ssl_ctx = socket.native_handle(); + if (type == boost::asio::ssl::stream_base::client && !host.empty() && ssl_ctx) + SSL_set_tlsext_host_name(ssl_ctx, host.c_str()); + } + /* Using system-wide CA store for client verification is funky - there is no expected hostname for server to verify against. If server doesn't have @@ -513,11 +520,7 @@ void ssl_options_t::configure( { socket.set_verify_mode(boost::asio::ssl::verify_peer | boost::asio::ssl::verify_fail_if_no_peer_cert); - // in case server is doing "virtual" domains, set hostname - SSL* const ssl_ctx = socket.native_handle(); - if (type == boost::asio::ssl::stream_base::client && !host.empty() && ssl_ctx) - SSL_set_tlsext_host_name(ssl_ctx, host.c_str()); - + socket.set_verify_callback([&](const bool preverified, boost::asio::ssl::verify_context &ctx) { // preverified means it passed system or user CA check. System CA is never loaded diff --git a/contrib/epee/src/readline_buffer.cpp b/contrib/epee/src/readline_buffer.cpp index 1047d1696..ac68d1fdb 100644 --- a/contrib/epee/src/readline_buffer.cpp +++ b/contrib/epee/src/readline_buffer.cpp @@ -238,6 +238,10 @@ static char** attempted_completion(const char* text, int start, int end) static void install_line_handler() { +#if RL_READLINE_VERSION >= 0x0801 + rl_variable_bind("enable-bracketed-paste", "off"); +#endif + rl_attempted_completion_function = attempted_completion; rl_callback_handler_install("", handle_line); stifle_history(500); diff --git a/contrib/gitian/DOCKRUN.md b/contrib/gitian/DOCKRUN.md index d8cf8222e..ef302c1e5 100644 --- a/contrib/gitian/DOCKRUN.md +++ b/contrib/gitian/DOCKRUN.md @@ -57,7 +57,7 @@ The dockrun.sh script will do everything to build the binaries. Just specify the version to build as its only argument, e.g. ```bash -VERSION=v0.18.2.2 +VERSION=v0.18.3.2 ./dockrun.sh $VERSION ``` diff --git a/contrib/gitian/README.md b/contrib/gitian/README.md index 153af7541..37346006a 100644 --- a/contrib/gitian/README.md +++ b/contrib/gitian/README.md @@ -133,7 +133,7 @@ Common setup part: su - gitianuser GH_USER=YOUR_GITHUB_USER_NAME -VERSION=v0.18.2.2 +VERSION=v0.18.3.2 ``` Where `GH_USER` is your GitHub user name and `VERSION` is the version tag you want to build. diff --git a/contrib/gitian/gitian-linux.yml b/contrib/gitian/gitian-linux.yml index 63d2bc5d2..41915deb9 100644 --- a/contrib/gitian/gitian-linux.yml +++ b/contrib/gitian/gitian-linux.yml @@ -21,6 +21,7 @@ packages: - "g++-7-arm-linux-gnueabihf" - "gcc-arm-linux-gnueabihf" - "g++-arm-linux-gnueabihf" +- "g++-riscv64-linux-gnu" - "g++-7-multilib" - "gcc-7-multilib" - "binutils-arm-linux-gnueabihf" @@ -43,7 +44,7 @@ files: [] script: | WRAP_DIR=$HOME/wrapped - HOSTS="x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu i686-linux-gnu" + HOSTS="x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu i686-linux-gnu riscv64-linux-gnu" FAKETIME_HOST_PROGS="" FAKETIME_PROGS="date" HOST_CFLAGS="-O2 -g" @@ -159,7 +160,13 @@ script: | fi export C_INCLUDE_PATH="$EXTRA_INCLUDES" export CPLUS_INCLUDE_PATH="$EXTRA_INCLUDES" - cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DBACKCOMPAT=ON -DCMAKE_SKIP_RPATH=ON + # glibc only added riscv support in 2.27, disable backwards compatibility + if [ "$i" == "riscv64-linux-gnu" ]; then + BACKCOMPAT_OPTION=OFF + else + BACKCOMPAT_OPTION=ON + fi + cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DBACKCOMPAT=${BACKCOMPAT_OPTION} -DCMAKE_SKIP_RPATH=ON make ${MAKEOPTS} chmod 755 bin/* cp ../LICENSE ../README.md ../docs/ANONYMITY_NETWORKS.md bin diff --git a/docs/ANONYMITY_NETWORKS.md b/docs/ANONYMITY_NETWORKS.md index f8d08b05f..16099aea8 100644 --- a/docs/ANONYMITY_NETWORKS.md +++ b/docs/ANONYMITY_NETWORKS.md @@ -71,13 +71,13 @@ type, and max connections: ``` --anonymous-inbound rveahdfho7wo4b2m.onion:28083,127.0.0.1:28083,25 ---anonymous-inbound cmeua5767mz2q5jsaelk2rxhf67agrwuetaso5dzbenyzwlbkg2q.b32.i2p:5000,127.0.0.1:30000 +--anonymous-inbound cmeua5767mz2q5jsaelk2rxhf67agrwuetaso5dzbenyzwlbkg2q.b32.i2p,127.0.0.1:30000 ``` which tells `monerod` that a max of 25 inbound Tor connections are being received at address "rveahdfho7wo4b2m.onion:28083" and forwarded to `monerod` localhost port 28083, and a default max I2P connections are being received at -address "cmeua5767mz2q5jsaelk2rxhf67agrwuetaso5dzbenyzwlbkg2q.b32.i2p:5000" and +address "cmeua5767mz2q5jsaelk2rxhf67agrwuetaso5dzbenyzwlbkg2q.b32.i2p" and forwarded to `monerod` localhost port 30000. These addresses will be shared with outgoing peers, over the same network type, otherwise the peer will not be notified of the peer address by the proxy. diff --git a/external/easylogging++/easylogging++.cc b/external/easylogging++/easylogging++.cc index a765ee8cc..891936b6b 100644 --- a/external/easylogging++/easylogging++.cc +++ b/external/easylogging++/easylogging++.cc @@ -149,6 +149,11 @@ static el::Color colorFromLevel(el::Level level) static void setConsoleColor(el::Color color, bool bright) { + static const char *no_color_var = getenv("NO_COLOR"); + static const bool no_color = no_color_var && *no_color_var; // apparently, NO_COLOR=0 means no color too (as per no-color.org) + if (no_color) + return; + #if ELPP_OS_WINDOWS HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE); switch (color) diff --git a/external/trezor-common b/external/trezor-common index bff7fdfe4..6405ac6e2 160000 --- a/external/trezor-common +++ b/external/trezor-common @@ -1 +1 @@ -Subproject commit bff7fdfe436c727982cc553bdfb29a9021b423b0 +Subproject commit 6405ac6e2708938ffd863129e187879bf74d22f3 diff --git a/src/blocks/checkpoints.dat b/src/blocks/checkpoints.dat index eb3a40fa2..d304c30de 100644 Binary files a/src/blocks/checkpoints.dat and b/src/blocks/checkpoints.dat differ diff --git a/src/checkpoints/checkpoints.cpp b/src/checkpoints/checkpoints.cpp index 507e807e2..c8cfb1289 100644 --- a/src/checkpoints/checkpoints.cpp +++ b/src/checkpoints/checkpoints.cpp @@ -246,6 +246,9 @@ namespace cryptonote ADD_CHECKPOINT2(2817000, "39726d19ccaac01d150bec827b877ffae710b516bd633503662036ef4422e577", "0x3900669561954c1"); ADD_CHECKPOINT2(2844000, "28fc7b446dfef5b469f5778eb72ddf32a307a5f5a9823d1c394e772349e05d40", "0x3af384ec0e97d12"); ADD_CHECKPOINT2(2851000, "5bf0e47fc782263191a33f63a67db6c711781dc2a3c442e17ed901ec401be5c9", "0x3b6cd8a8ed610e8"); + ADD_CHECKPOINT2(2971000, "3d4cac5ac515eeabd18769ab943af85f36db51d28720def0d0e6effc2c8f5ce3", "0x436e532738b8b5b"); + ADD_CHECKPOINT2(2985000, "08f5e6b7301c1b6ed88268a28f8677a06e8ff943b3f9e48d3080f71f9c134bfb", "0x444b7b42a633c96"); + ADD_CHECKPOINT2(3088000, "bddf8ca09110d33d6d497f13a113630c2b6af1c84d4f3a6f35cb1446f2604ade", "0x4aed3615c2f8c3e"); return true; } diff --git a/src/common/combinator.h b/src/common/combinator.h index 0d35e4786..f322aeba7 100644 --- a/src/common/combinator.h +++ b/src/common/combinator.h @@ -34,6 +34,7 @@ #include #include #include +#include namespace tools { diff --git a/src/common/perf_timer.cpp b/src/common/perf_timer.cpp index 30164a557..9b0fe5561 100644 --- a/src/common/perf_timer.cpp +++ b/src/common/perf_timer.cpp @@ -62,7 +62,7 @@ namespace tools while (1) { t1 = epee::misc_utils::get_ns_count(); - if (t1 - t0 > 1*1000000000) break; // work one second + if (t1 - t0 > 1*100000000) break; // work 0.1 seconds } uint64_t r1 = get_tick_count(); diff --git a/src/common/util.cpp b/src/common/util.cpp index f0de73a06..4b5e2adb8 100644 --- a/src/common/util.cpp +++ b/src/common/util.cpp @@ -882,13 +882,6 @@ std::string get_nix_version_display_string() bool is_local_address(const std::string &address) { - // always assume Tor/I2P addresses to be untrusted by default - if (is_privacy_preserving_network(address)) - { - MDEBUG("Address '" << address << "' is Tor/I2P, non local"); - return false; - } - // extract host epee::net_utils::http::url_content u_c; if (!epee::net_utils::parse_url(address, u_c)) @@ -902,20 +895,22 @@ std::string get_nix_version_display_string() return false; } - // resolve to IP - boost::asio::io_service io_service; - boost::asio::ip::tcp::resolver resolver(io_service); - boost::asio::ip::tcp::resolver::query query(u_c.host, ""); - boost::asio::ip::tcp::resolver::iterator i = resolver.resolve(query); - while (i != boost::asio::ip::tcp::resolver::iterator()) + if (u_c.host == "localhost" || boost::ends_with(u_c.host, ".localhost")) { // RFC 6761 (6.3) + MDEBUG("Address '" << address << "' is local"); + return true; + } + + boost::system::error_code ec; + const auto parsed_ip = boost::asio::ip::address::from_string(u_c.host, ec); + if (ec) { + MDEBUG("Failed to parse '" << address << "' as IP address: " << ec.message() << ". Considering it not local"); + return false; + } + + if (parsed_ip.is_loopback()) { - const boost::asio::ip::tcp::endpoint &ep = *i; - if (ep.address().is_loopback()) - { - MDEBUG("Address '" << address << "' is local"); - return true; - } - ++i; + MDEBUG("Address '" << address << "' is local"); + return true; } MDEBUG("Address '" << address << "' is not local"); diff --git a/src/crypto/jh.c b/src/crypto/jh.c index 12d536375..738c681f8 100644 --- a/src/crypto/jh.c +++ b/src/crypto/jh.c @@ -34,7 +34,7 @@ typedef struct { unsigned long long databitlen; /*the message size in bits*/ unsigned long long datasize_in_buffer; /*the size of the message remained in buffer; assumed to be multiple of 8bits except for the last partial block at the end of the message*/ DATA_ALIGN16(uint64 x[8][2]); /*the 1024-bit state, ( x[i][0] || x[i][1] ) is the ith row of the state in the pseudocode*/ - unsigned char buffer[64]; /*the 512-bit message block to be hashed;*/ + DATA_ALIGN16(unsigned char buffer[64]); /*the 512-bit message block to be hashed;*/ } hashState; @@ -213,16 +213,24 @@ static void E8(hashState *state) /*The compression function F8 */ static void F8(hashState *state) { - uint64 i; + uint64_t* x = (uint64_t*)state->x; /*xor the 512-bit message with the fist half of the 1024-bit hash state*/ - for (i = 0; i < 8; i++) state->x[i >> 1][i & 1] ^= ((uint64*)state->buffer)[i]; + for (int i = 0; i < 8; ++i) { + uint64 b; + memcpy(&b, &state->buffer[i << 3], sizeof(b)); + x[i] ^= b; + } /*the bijective function E8 */ E8(state); /*xor the 512-bit message with the second half of the 1024-bit hash state*/ - for (i = 0; i < 8; i++) state->x[(8+i) >> 1][(8+i) & 1] ^= ((uint64*)state->buffer)[i]; + for (int i = 0; i < 8; ++i) { + uint64 b; + memcpy(&b, &state->buffer[i << 3], sizeof(b)); + x[i + 8] ^= b; + } } /*before hashing a message, initialize the hash state as H0 */ @@ -240,6 +248,7 @@ static HashReturn Init(hashState *state, int hashbitlen) case 224: memcpy(state->x,JH224_H0,128); break; case 256: memcpy(state->x,JH256_H0,128); break; case 384: memcpy(state->x,JH384_H0,128); break; + default: case 512: memcpy(state->x,JH512_H0,128); break; } diff --git a/src/cryptonote_basic/cryptonote_format_utils.cpp b/src/cryptonote_basic/cryptonote_format_utils.cpp index 829e5fc70..8be23583b 100644 --- a/src/cryptonote_basic/cryptonote_format_utils.cpp +++ b/src/cryptonote_basic/cryptonote_format_utils.cpp @@ -1229,7 +1229,7 @@ namespace cryptonote char *end = NULL; errno = 0; const unsigned long long ull = strtoull(buf, &end, 10); - CHECK_AND_ASSERT_THROW_MES(ull != ULONG_MAX || errno == 0, "Failed to parse rounded amount: " << buf); + CHECK_AND_ASSERT_THROW_MES(ull != ULLONG_MAX || errno == 0, "Failed to parse rounded amount: " << buf); CHECK_AND_ASSERT_THROW_MES(ull != 0 || amount == 0, "Overflow in rounding"); return ull; } diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp index 98f1555b6..71b8f78cc 100644 --- a/src/cryptonote_basic/miner.cpp +++ b/src/cryptonote_basic/miner.cpp @@ -523,7 +523,7 @@ namespace cryptonote bool miner::worker_thread() { const uint32_t th_local_index = m_thread_index++; // atomically increment, getting value before increment - crypto::rx_set_miner_thread(th_local_index, tools::get_max_concurrency()); + bool rx_set = false; MLOG_SET_THREAD_NAME(std::string("[miner ") + std::to_string(th_local_index) + "]"); MGINFO("Miner thread was started ["<< th_local_index << "]"); @@ -575,6 +575,13 @@ namespace cryptonote b.nonce = nonce; crypto::hash h; + + if ((b.major_version >= RX_BLOCK_VERSION) && !rx_set) + { + crypto::rx_set_miner_thread(th_local_index, tools::get_max_concurrency()); + rx_set = true; + } + m_gbh(b, height, NULL, tools::get_max_concurrency(), h); if(check_hash(h, local_diff)) diff --git a/src/cryptonote_basic/tx_extra.h b/src/cryptonote_basic/tx_extra.h index 141f72352..c168f48a7 100644 --- a/src/cryptonote_basic/tx_extra.h +++ b/src/cryptonote_basic/tx_extra.h @@ -52,7 +52,7 @@ namespace cryptonote // load template