From a00024cf51dc799675a8813a0414480214f9baf9 Mon Sep 17 00:00:00 2001 From: XMRig Date: Sat, 5 May 2018 22:44:20 +0700 Subject: [PATCH 1/8] Fixed ARMv8 build. --- src/crypto/CryptoNight_arm.h | 78 ++++++++++++++++++++++++------------ 1 file changed, 53 insertions(+), 25 deletions(-) diff --git a/src/crypto/CryptoNight_arm.h b/src/crypto/CryptoNight_arm.h index 746de79c..284b1f5f 100644 --- a/src/crypto/CryptoNight_arm.h +++ b/src/crypto/CryptoNight_arm.h @@ -27,6 +27,7 @@ #define __CRYPTONIGHT_ARM_H__ +#include "common/crypto/keccak.h" #include "common/utils/mm_malloc.h" #include "crypto/CryptoNight.h" #include "crypto/CryptoNight_constants.h" @@ -36,7 +37,6 @@ extern "C" { -#include "crypto/c_keccak.h" #include "crypto/c_groestl.h" #include "crypto/c_blake256.h" #include "crypto/c_jh.h" @@ -380,6 +380,7 @@ static inline void cn_implode_scratchpad(const __m128i *input, __m128i *output) } +template static inline void cryptonight_monero_tweak(uint64_t* mem_out, __m128i tmp) { mem_out[0] = EXTRACT64(tmp); @@ -388,7 +389,7 @@ static inline void cryptonight_monero_tweak(uint64_t* mem_out, __m128i tmp) uint8_t x = vh >> 24; static const uint16_t table = 0x7531; - const uint8_t index = (((x >> 3) & 6) | (x & 1)) << 1; + const uint8_t index = (((x >> SHIFT) & 6) | (x & 1)) << 1; vh ^= ((table >> index) & 0x3) << 28; mem_out[1] = vh; @@ -407,7 +408,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si return; } - keccak(input, (int) size, ctx[0]->state, 200); + xmrig::keccak(input, size, ctx[0]->state); VARIANT1_INIT(0); @@ -434,7 +435,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si } if (VARIANT > 0) { - cryptonight_monero_tweak((uint64_t*)&l0[idx0 & MASK], _mm_xor_si128(bx0, cx)); + cryptonight_monero_tweak((uint64_t*)&l0[idx0 & MASK], _mm_xor_si128(bx0, cx)); } else { _mm_store_si128((__m128i *)&l0[idx0 & MASK], _mm_xor_si128(bx0, cx)); } @@ -450,13 +451,22 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si al0 += hi; ah0 += lo; - VARIANT1_2(ah0, 0); ((uint64_t*)&l0[idx0 & MASK])[0] = al0; - ((uint64_t*)&l0[idx0 & MASK])[1] = ah0; - VARIANT1_2(ah0, 0); - ah0 ^= ch; + if (VARIANT > 0) { + if (VARIANT == xmrig::VARIANT_IPBC) { + ((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0 ^ al0; + } + else { + ((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0; + } + } + else { + ((uint64_t*)&l0[idx0 & MASK])[1] = ah0; + } + al0 ^= cl; + ah0 ^= ch; idx0 = al0; if (ALGO == xmrig::CRYPTONIGHT_HEAVY) { @@ -471,7 +481,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si cn_implode_scratchpad((__m128i*) ctx[0]->memory, (__m128i*) ctx[0]->state); - keccakf(h0, 24); + xmrig::keccakf(h0, 24); extra_hashes[ctx[0]->state[0] & 3](ctx[0]->state, 200, output); } @@ -488,8 +498,8 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si return; } - keccak(input, (int) size, ctx[0]->state, 200); - keccak(input + size, (int) size, ctx[1]->state, 200); + xmrig::keccak(input, size, ctx[0]->state); + xmrig::keccak(input + size, size, ctx[1]->state); VARIANT1_INIT(0); VARIANT1_INIT(1); @@ -528,8 +538,8 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si } if (VARIANT > 0) { - cryptonight_monero_tweak((uint64_t*)&l0[idx0 & MASK], _mm_xor_si128(bx0, cx0)); - cryptonight_monero_tweak((uint64_t*)&l1[idx1 & MASK], _mm_xor_si128(bx1, cx1)); + cryptonight_monero_tweak((uint64_t*)&l0[idx0 & MASK], _mm_xor_si128(bx0, cx0)); + cryptonight_monero_tweak((uint64_t*)&l1[idx1 & MASK], _mm_xor_si128(bx1, cx1)); } else { _mm_store_si128((__m128i *) &l0[idx0 & MASK], _mm_xor_si128(bx0, cx0)); _mm_store_si128((__m128i *) &l1[idx1 & MASK], _mm_xor_si128(bx1, cx1)); @@ -549,13 +559,22 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si al0 += hi; ah0 += lo; - VARIANT1_2(ah0, 0); - ((uint64_t*) &l0[idx0 & MASK])[0] = al0; - ((uint64_t*) &l0[idx0 & MASK])[1] = ah0; - VARIANT1_2(ah0, 0); + ((uint64_t*)&l0[idx0 & MASK])[0] = al0; + + if (VARIANT > 0) { + if (VARIANT == xmrig::VARIANT_IPBC) { + ((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0 ^ al0; + } + else { + ((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0; + } + } + else { + ((uint64_t*)&l0[idx0 & MASK])[1] = ah0; + } - ah0 ^= ch; al0 ^= cl; + ah0 ^= ch; idx0 = al0; if (ALGO == xmrig::CRYPTONIGHT_HEAVY) { @@ -574,13 +593,22 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si al1 += hi; ah1 += lo; - VARIANT1_2(ah1, 1); - ((uint64_t*) &l1[idx1 & MASK])[0] = al1; - ((uint64_t*) &l1[idx1 & MASK])[1] = ah1; - VARIANT1_2(ah1, 1); + ((uint64_t*)&l1[idx1 & MASK])[0] = al1; + + if (VARIANT > 0) { + if (VARIANT == xmrig::VARIANT_IPBC) { + ((uint64_t*)&l1[idx1 & MASK])[1] = ah1 ^ tweak1_2_1 ^ al1; + } + else { + ((uint64_t*)&l1[idx1 & MASK])[1] = ah1 ^ tweak1_2_1; + } + } + else { + ((uint64_t*)&l1[idx1 & MASK])[1] = ah1; + } - ah1 ^= ch; al1 ^= cl; + ah1 ^= ch; idx1 = al1; if (ALGO == xmrig::CRYPTONIGHT_HEAVY) { @@ -596,8 +624,8 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si cn_implode_scratchpad((__m128i*) l0, (__m128i*) h0); cn_implode_scratchpad((__m128i*) l1, (__m128i*) h1); - keccakf(h0, 24); - keccakf(h1, 24); + xmrig::keccakf(h0, 24); + xmrig::keccakf(h1, 24); extra_hashes[ctx[0]->state[0] & 3](ctx[0]->state, 200, output); extra_hashes[ctx[1]->state[0] & 3](ctx[1]->state, 200, output + 32); From a1c5afa38313ea1d04ede8defac4d24098e5ed96 Mon Sep 17 00:00:00 2001 From: XMRig Date: Mon, 7 May 2018 00:56:39 +0700 Subject: [PATCH 2/8] Fix Termux build. --- src/common/Platform_unix.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common/Platform_unix.cpp b/src/common/Platform_unix.cpp index 63cd1c8b..97b32ee8 100644 --- a/src/common/Platform_unix.cpp +++ b/src/common/Platform_unix.cpp @@ -29,11 +29,13 @@ #endif +#include #include #include #include #include #include +#include #include From c89889cc5782e38d79b4c381878f75fd590bce5a Mon Sep 17 00:00:00 2001 From: XMRig Date: Mon, 7 May 2018 02:09:25 +0700 Subject: [PATCH 3/8] #607 Fixed donation bug. --- src/common/net/Pool.cpp | 4 ++++ src/net/strategies/DonateStrategy.cpp | 2 +- src/version.h | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/common/net/Pool.cpp b/src/common/net/Pool.cpp index 06622d28..ca73b315 100644 --- a/src/common/net/Pool.cpp +++ b/src/common/net/Pool.cpp @@ -91,6 +91,10 @@ Pool::Pool(const char *host, uint16_t port, const char *user, const char *passwo bool Pool::isCompatible(const xmrig::Algorithm &algorithm) const { + if (m_algorithms.empty()) { + return true; + } + for (const auto &a : m_algorithms) { if (algorithm == a) { return true; diff --git a/src/net/strategies/DonateStrategy.cpp b/src/net/strategies/DonateStrategy.cpp index b4b41938..7de776ef 100644 --- a/src/net/strategies/DonateStrategy.cpp +++ b/src/net/strategies/DonateStrategy.cpp @@ -68,7 +68,7 @@ DonateStrategy::DonateStrategy(int level, const char *user, xmrig::Algo algo, IS } for (Pool &pool : m_pools) { - pool.algorithm().setAlgo(algo); + pool.adjust(algo); } if (m_pools.size() > 1) { diff --git a/src/version.h b/src/version.h index 2263de9d..f9f02dcc 100644 --- a/src/version.h +++ b/src/version.h @@ -27,7 +27,7 @@ #define APP_ID "xmrig" #define APP_NAME "XMRig" #define APP_DESC "XMRig CPU miner" -#define APP_VERSION "2.6.1" +#define APP_VERSION "2.6.2" #define APP_DOMAIN "xmrig.com" #define APP_SITE "www.xmrig.com" #define APP_COPYRIGHT "Copyright (C) 2016-2018 xmrig.com" @@ -35,7 +35,7 @@ #define APP_VER_MAJOR 2 #define APP_VER_MINOR 6 -#define APP_VER_PATCH 1 +#define APP_VER_PATCH 2 #ifdef _MSC_VER # if (_MSC_VER >= 1910) From bee1285e3a23d9b23ab5d8a773004b1d5f8b8100 Mon Sep 17 00:00:00 2001 From: xmrig Date: Mon, 7 May 2018 02:17:20 +0700 Subject: [PATCH 4/8] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c09ddc5..c99e646f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# v2.6.2 + - [#607](https://github.com/xmrig/xmrig/issues/607) Fixed donation bug. + - [#610](https://github.com/xmrig/xmrig/issues/610) Fixed ARM build. + # v2.6.1 - [#168](https://github.com/xmrig/xmrig-proxy/issues/168) Added support for [mining algorithm negotiation](https://github.com/xmrig/xmrig-proxy/blob/dev/doc/STRATUM_EXT.md#1-mining-algorithm-negotiation). - Added IPBC coin support, base algorithm `cn-lite` variant `ipbc`. From 8d61df7cc948c833f5c746f743a26d6177aa145a Mon Sep 17 00:00:00 2001 From: xmrig Date: Mon, 7 May 2018 14:27:48 +0700 Subject: [PATCH 5/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d69e5ec5..250ca54b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # XMRig -:warning: **You must update miners to version 2.5 before April 6 due [Monero PoW change](https://getmonero.org/2018/02/11/PoW-change-and-key-reuse.html).** +:warning: **If you mine Monero, Aeon, Sumokoin, Turtlecoin, Stellite, GRAFT, Haven Protocol, IPBC, [PLEASE READ](https://github.com/xmrig/xmrig/issues/482)!** :warning: [![Github All Releases](https://img.shields.io/github/downloads/xmrig/xmrig/total.svg)](https://github.com/xmrig/xmrig/releases) [![GitHub release](https://img.shields.io/github/release/xmrig/xmrig/all.svg)](https://github.com/xmrig/xmrig/releases) From d7d3fec0582c5b79f4af6902ccd1b3b8a9b4eec6 Mon Sep 17 00:00:00 2001 From: XMRig Date: Tue, 8 May 2018 02:39:11 +0700 Subject: [PATCH 6/8] #614 Fix display issue with huge pages percentage when colors disabled. --- src/workers/Workers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/workers/Workers.cpp b/src/workers/Workers.cpp index 8991966e..f6ec04b7 100644 --- a/src/workers/Workers.cpp +++ b/src/workers/Workers.cpp @@ -307,7 +307,7 @@ void Workers::start(IWorker *worker) m_status.hugePages, m_status.pages, percent, memory); } else { - LOG_INFO("READY (CPU) threads %zu(%zu) huge pages %zu/%zu %f%% memory %zu.0 MB", + LOG_INFO("READY (CPU) threads %zu(%zu) huge pages %zu/%zu %1.0f%% memory %zu.0 MB", m_status.threads, m_status.ways, m_status.hugePages, m_status.pages, percent, memory); } } From 6a4f817693d51b38b70b8a7290d005f5c1ae900b Mon Sep 17 00:00:00 2001 From: XMRig Date: Tue, 8 May 2018 06:19:10 +0700 Subject: [PATCH 7/8] #615 Fixed build without libcpuid. --- src/Cpu_stub.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Cpu_stub.cpp b/src/Cpu_stub.cpp index 87d9de75..8b27ad65 100644 --- a/src/Cpu_stub.cpp +++ b/src/Cpu_stub.cpp @@ -4,8 +4,8 @@ * Copyright 2014 Lucas Jones * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee - * Copyright 2016-2017 XMRig - * + * Copyright 2017-2018 XMR-Stak , + * Copyright 2016-2018 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -110,12 +110,12 @@ int Cpu::m_l2_cache = 0; int Cpu::m_l3_cache = 0; int Cpu::m_sockets = 1; int Cpu::m_totalCores = 0; -int Cpu::m_totalThreads = 0; +size_t Cpu::m_totalThreads = 0; -int Cpu::optimalThreadsCount(int algo, bool doubleHash, int maxCpuUsage) +size_t Cpu::optimalThreadsCount(size_t size, int maxCpuUsage) { - int count = m_totalThreads / 2; + const size_t count = m_totalThreads / 2; return count < 1 ? 1 : count; } From 19f409a85bec43eb84fc2b71a5b52670c38ed306 Mon Sep 17 00:00:00 2001 From: WHR Date: Tue, 15 May 2018 03:12:12 +0800 Subject: [PATCH 8/8] Fix FileLog error 'invalid seek' on non-seekable files --- src/common/log/FileLog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/log/FileLog.cpp b/src/common/log/FileLog.cpp index c8eaf5f7..cc7188cb 100644 --- a/src/common/log/FileLog.cpp +++ b/src/common/log/FileLog.cpp @@ -93,5 +93,5 @@ void FileLog::write(char *data, size_t size) uv_fs_t *req = new uv_fs_t; req->data = buf.base; - uv_fs_write(uv_default_loop(), req, m_file, &buf, 1, 0, FileLog::onWrite); + uv_fs_write(uv_default_loop(), req, m_file, &buf, 1, -1, FileLog::onWrite); }