Compare commits

...

9 Commits

Author SHA1 Message Date
Jonathan "Duke" Leto 2f9cb48f40 Do not validate wallet addresses for now 2 years ago
Jonathan "Duke" Leto 85120d84f0 Add a new randomx flavor: Hush Smart Chain (DRAGONX) support 2 years ago
xmrig 1aa0e37b54
Merge pull request #3161 from SChernykh/dev 2 years ago
SChernykh 807c64ddb1 MSVC build: enabled parallel compilation 2 years ago
XMRig 5bf90704a6
#2869 2 years ago
xmrig 912d1e362b
Merge pull request #3144 from Spudz76/dev-updateSSE2NEON 2 years ago
Tony Butler eeb459506c Update to latest sse2neon.h from github:DLTcollab/sse2neon 2 years ago
XMRig f4ec0287c4
v6.18.2-dev 2 years ago
XMRig 483d6ada3d
Merge branch 'master' into dev 2 years ago
  1. 1
      .gitignore
  2. 8
      cmake/flags.cmake
  3. 2
      doc/build/CMAKE_OPTIONS.md
  4. 1
      scripts/generate_cl.js
  5. 1
      src/backend/opencl/cl/cn/algorithm.cl
  6. 2
      src/backend/opencl/cl/rx/randomx.cl
  7. 97
      src/backend/opencl/cl/rx/randomx_constants_dragonx.h
  8. 7
      src/base/crypto/Algorithm.cpp
  9. 3
      src/base/crypto/Algorithm.h
  10. 2
      src/base/crypto/Coin.cpp
  11. 2
      src/base/crypto/Coin.h
  12. 14
      src/base/net/stratum/DaemonClient.cpp
  13. 4
      src/base/tools/cryptonote/WalletAddress.h
  14. 12708
      src/crypto/cn/sse2neon.h
  15. 13
      src/crypto/randomx/randomx.cpp
  16. 2
      src/crypto/randomx/randomx.h
  17. 4
      src/crypto/rx/RxAlgo.cpp
  18. 18
      src/donate.h
  19. 4
      src/version.h

1
.gitignore

@ -4,3 +4,4 @@ scripts/deps
/CMakeLists.txt.user
/.idea
/src/backend/opencl/cl/cn/cryptonight_gen.cl
.*sw?

8
cmake/flags.cmake

@ -61,11 +61,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
add_definitions(/DHAVE_BUILTIN_CLEAR_CACHE)
elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
set(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Oi /DNDEBUG /GL")
set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Oi /DNDEBUG /GL")
set(CMAKE_C_FLAGS_RELEASE "/MP /MT /O2 /Oi /DNDEBUG /GL")
set(CMAKE_CXX_FLAGS_RELEASE "/MP /MT /O2 /Oi /DNDEBUG /GL")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/Ob1 /Zi /DRELWITHDEBINFO")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Ob1 /Zi /DRELWITHDEBINFO")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MP /Ob1 /Zi /DRELWITHDEBINFO")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MP /Ob1 /Zi /DRELWITHDEBINFO")
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
add_definitions(/D_CRT_NONSTDC_NO_WARNINGS)

2
doc/build/CMAKE_OPTIONS.md

@ -6,7 +6,7 @@
* **`-DWITH_CN_LITE=OFF`** disable all CryptoNight-Lite algorithms (`cn-lite/0`, `cn-lite/1`).
* **`-DWITH_CN_HEAVY=OFF`** disable all CryptoNight-Heavy algorithms (`cn-heavy/0`, `cn-heavy/xhv`, `cn-heavy/tube`).
* **`-DWITH_CN_PICO=OFF`** disable CryptoNight-Pico algorithm (`cn-pico`).
* **`-DWITH_RANDOMX=OFF`** disable RandomX algorithms (`rx/loki`, `rx/wow`).
* **`-DWITH_RANDOMX=OFF`** disable RandomX algorithms (`rx/wow`, `rx/arq`, `rx/graft`, `rx/sfx`, `rx/keva`, `rx/dragonx`).
* **`-DWITH_ARGON2=OFF`** disable Argon2 algorithms (`argon2/chukwa`, `argon2/wrkz`).
## Features

1
scripts/generate_cl.js

@ -52,6 +52,7 @@ function rx()
'randomx_constants_arqma.h',
'randomx_constants_keva.h',
'randomx_constants_graft.h',
'randomx_constants_dragonx.h',
'aes.cl',
'blake2b.cl',
'randomx_vm.cl',

1
src/backend/opencl/cl/cn/algorithm.cl

@ -24,6 +24,7 @@
#define ALGO_RX_SFX 0x72151273
#define ALGO_RX_KEVA 0x7214116b
#define ALGO_RX_GRAFT 0x72151267
#define ALGO_RX_DRAGONX 0x72160000
#define ALGO_AR2_CHUKWA 0x61130000
#define ALGO_AR2_CHUKWA_V2 0x61140000
#define ALGO_AR2_WRKZ 0x61120000

2
src/backend/opencl/cl/rx/randomx.cl

@ -10,6 +10,8 @@
#include "randomx_constants_keva.h"
#elif (ALGO == ALGO_RX_GRAFT)
#include "randomx_constants_graft.h"
#elif (ALGO == ALGO_RX_DRAGONX)
#include "randomx_constants_dragonx.h"
#endif
#include "aes.cl"

97
src/backend/opencl/cl/rx/randomx_constants_dragonx.h

@ -0,0 +1,97 @@
/*
Copyright (c) 2019 SChernykh
Copyright (c) 2022 Duke Leto <https://git.hush.is/duke>
This file is part of RandomX OpenCL.
RandomX OpenCL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
RandomX OpenCL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with RandomX OpenCL. If not, see <http://www.gnu.org/licenses/>.
*/
//Dataset base size in bytes. Must be a power of 2.
#define RANDOMX_DATASET_BASE_SIZE 2147483648
//Dataset extra size. Must be divisible by 64.
#define RANDOMX_DATASET_EXTRA_SIZE 33554368
//Scratchpad L3 size in bytes. Must be a power of 2.
#define RANDOMX_SCRATCHPAD_L3 2097152
//Scratchpad L2 size in bytes. Must be a power of two and less than or equal to RANDOMX_SCRATCHPAD_L3.
#define RANDOMX_SCRATCHPAD_L2 262144
//Scratchpad L1 size in bytes. Must be a power of two (minimum 64) and less than or equal to RANDOMX_SCRATCHPAD_L2.
#define RANDOMX_SCRATCHPAD_L1 16384
//Jump condition mask size in bits.
#define RANDOMX_JUMP_BITS 8
//Jump condition mask offset in bits. The sum of RANDOMX_JUMP_BITS and RANDOMX_JUMP_OFFSET must not exceed 16.
#define RANDOMX_JUMP_OFFSET 8
//Integer instructions
#define RANDOMX_FREQ_IADD_RS 16
#define RANDOMX_FREQ_IADD_M 7
#define RANDOMX_FREQ_ISUB_R 16
#define RANDOMX_FREQ_ISUB_M 7
#define RANDOMX_FREQ_IMUL_R 16
#define RANDOMX_FREQ_IMUL_M 4
#define RANDOMX_FREQ_IMULH_R 4
#define RANDOMX_FREQ_IMULH_M 1
#define RANDOMX_FREQ_ISMULH_R 4
#define RANDOMX_FREQ_ISMULH_M 1
#define RANDOMX_FREQ_IMUL_RCP 8
#define RANDOMX_FREQ_INEG_R 2
#define RANDOMX_FREQ_IXOR_R 15
#define RANDOMX_FREQ_IXOR_M 5
#define RANDOMX_FREQ_IROR_R 7
#define RANDOMX_FREQ_IROL_R 3
#define RANDOMX_FREQ_ISWAP_R 4
//Floating point instructions
#define RANDOMX_FREQ_FSWAP_R 4
#define RANDOMX_FREQ_FADD_R 16
#define RANDOMX_FREQ_FADD_M 5
#define RANDOMX_FREQ_FSUB_R 16
#define RANDOMX_FREQ_FSUB_M 5
#define RANDOMX_FREQ_FSCAL_R 6
#define RANDOMX_FREQ_FMUL_R 32
#define RANDOMX_FREQ_FDIV_M 4
#define RANDOMX_FREQ_FSQRT_R 6
//Control instructions
#define RANDOMX_FREQ_CBRANCH 25
#define RANDOMX_FREQ_CFROUND 1
//Store instruction
#define RANDOMX_FREQ_ISTORE 16
//No-op instruction
#define RANDOMX_FREQ_NOP 0
#define RANDOMX_DATASET_ITEM_SIZE 64
#define RANDOMX_PROGRAM_SIZE 280
#define HASH_SIZE 64
#define ENTROPY_SIZE (128 + RANDOMX_PROGRAM_SIZE * 8)
#define REGISTERS_SIZE 256
#define IMM_BUF_SIZE (RANDOMX_PROGRAM_SIZE * 4 - REGISTERS_SIZE)
#define IMM_INDEX_COUNT ((IMM_BUF_SIZE / 4) - 2)
#define VM_STATE_SIZE (REGISTERS_SIZE + IMM_BUF_SIZE + RANDOMX_PROGRAM_SIZE * 4)
#define ROUNDING_MODE (RANDOMX_FREQ_CFROUND ? -1 : 0)
// Scratchpad L1/L2/L3 bits
#define LOC_L1 (32 - 14)
#define LOC_L2 (32 - 18)
#define LOC_L3 (32 - 21)

7
src/base/crypto/Algorithm.cpp

@ -2,6 +2,7 @@
* Copyright (c) 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2022 Duke Leto <https://git.hush.is/duke>
*
* 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
@ -82,6 +83,7 @@ const char *Algorithm::kRX_ARQ = "rx/arq";
const char *Algorithm::kRX_GRAFT = "rx/graft";
const char *Algorithm::kRX_SFX = "rx/sfx";
const char *Algorithm::kRX_KEVA = "rx/keva";
const char *Algorithm::kRX_DRAGONX = "rx/dragonx";
#endif
#ifdef XMRIG_ALGO_ARGON2
@ -148,6 +150,7 @@ static const std::map<uint32_t, const char *> kAlgorithmNames = {
ALGO_NAME(RX_GRAFT),
ALGO_NAME(RX_SFX),
ALGO_NAME(RX_KEVA),
ALGO_NAME(RX_DRAGONX),
# endif
# ifdef XMRIG_ALGO_ARGON2
@ -263,6 +266,8 @@ static const std::map<const char *, Algorithm::Id, aliasCompare> kAlgorithmAlias
ALGO_ALIAS(RX_SFX, "randomsfx"),
ALGO_ALIAS_AUTO(RX_KEVA), ALGO_ALIAS(RX_KEVA, "randomx/keva"),
ALGO_ALIAS(RX_KEVA, "randomkeva"),
ALGO_ALIAS_AUTO(RX_DRAGONX), ALGO_ALIAS(RX_DRAGONX, "randomx/dragonx"),
ALGO_ALIAS(RX_DRAGONX, "randomdragonx"),
# endif
# ifdef XMRIG_ALGO_ARGON2
@ -350,7 +355,7 @@ std::vector<xmrig::Algorithm> xmrig::Algorithm::all(const std::function<bool(con
CN_HEAVY_0, CN_HEAVY_TUBE, CN_HEAVY_XHV,
CN_PICO_0, CN_PICO_TLO,
CN_UPX2,
RX_0, RX_WOW, RX_ARQ, RX_GRAFT, RX_SFX, RX_KEVA,
RX_0, RX_WOW, RX_ARQ, RX_GRAFT, RX_SFX, RX_KEVA, RX_DRAGONX,
AR2_CHUKWA, AR2_CHUKWA_V2, AR2_WRKZ,
KAWPOW_RVN,
GHOSTRIDER_RTM

3
src/base/crypto/Algorithm.h

@ -2,6 +2,7 @@
* Copyright (c) 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2022 Duke Leto <https://git.hush.is/duke>
*
* 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
@ -78,6 +79,7 @@ public:
RX_GRAFT = 0x72151267, // "rx/graft" RandomGRAFT (Graft).
RX_SFX = 0x72151273, // "rx/sfx" RandomSFX (Safex Cash).
RX_KEVA = 0x7214116b, // "rx/keva" RandomKEVA (Keva).
RX_DRAGONX = 0x72160000, // "rx/dragonx" RandomDragonX (DRAGONX).
AR2_CHUKWA = 0x61130000, // "argon2/chukwa" Argon2id (Chukwa).
AR2_CHUKWA_V2 = 0x61140000, // "argon2/chukwav2" Argon2id (Chukwa v2).
AR2_WRKZ = 0x61120000, // "argon2/wrkz" Argon2id (WRKZ)
@ -144,6 +146,7 @@ public:
static const char *kRX_GRAFT;
static const char *kRX_SFX;
static const char *kRX_KEVA;
static const char *kRX_DRAGONX;
# endif
# ifdef XMRIG_ALGO_ARGON2

2
src/base/crypto/Coin.cpp

@ -1,6 +1,7 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2022 Duke Leto <https://git.hush.is/duke>
*
* 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
@ -51,6 +52,7 @@ static const CoinInfo coinInfo[] = {
{ Algorithm::RX_ARQ, "ARQ", "ArQmA", 120, 1000000000, BLUE_BG_BOLD( WHITE_BOLD_S " arqma ") },
{ Algorithm::RX_GRAFT, "GRFT", "Graft", 120, 10000000000, BLUE_BG_BOLD( WHITE_BOLD_S " graft ") },
{ Algorithm::RX_KEVA, "KVA", "Kevacoin", 0, 0, MAGENTA_BG_BOLD(WHITE_BOLD_S " keva ") },
{ Algorithm::RX_DRAGONX, "DRGX", "DragonX", 0, 0, RED_BG_BOLD( WHITE_BOLD_S " dragonx ") },
{ Algorithm::KAWPOW_RVN, "RVN", "Ravencoin", 0, 0, BLUE_BG_BOLD( WHITE_BOLD_S " raven ") },
{ Algorithm::RX_WOW, "WOW", "Wownero", 300, 100000000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " wownero ") },
};

2
src/base/crypto/Coin.h

@ -1,6 +1,7 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2022 Duke Leto <https://git.hush.is/duke>
*
* 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
@ -37,6 +38,7 @@ public:
ARQMA,
GRAFT,
KEVA,
DRAGONX,
RAVEN,
WOWNERO,
MAX

14
src/base/net/stratum/DaemonClient.cpp

@ -202,9 +202,10 @@ void xmrig::DaemonClient::connect()
m_pool.setAlgo(m_coin.algorithm());
}
if ((m_apiVersion == API_MONERO) && !m_walletAddress.isValid()) {
return connectError("Invalid wallet address.");
}
// TODO: validate address
// if ((m_apiVersion == API_MONERO) && !m_walletAddress.isValid()) {
// return connectError("Invalid wallet address.");
// }
if (m_pool.zmq_port() >= 0) {
m_dns = Dns::resolve(m_pool.host(), this);
@ -430,9 +431,10 @@ bool xmrig::DaemonClient::parseJob(const rapidjson::Value &params, int *code)
return jobError("Failed to generate key derivation for miner signature.");
}
if (!m_walletAddress.decode(m_pool.user())) {
return jobError("Invalid wallet address.");
}
// TODO: decode HSC taddrs
// if (!m_walletAddress.decode(m_pool.user())) {
// return jobError("Invalid wallet address.");
// }
if (memcmp(m_walletAddress.spendKey(), public_spendkey, sizeof(public_spendkey)) != 0) {
return jobError("Wallet address and spend key don't match.");

4
src/base/tools/cryptonote/WalletAddress.h

@ -57,7 +57,9 @@ public:
inline bool decode(const char *address) { return decode(address, strlen(address)); }
inline bool decode(const String &address) { return decode(address, address.size()); }
inline bool isValid() const { return m_tag > 0 && m_data.size() >= kMinSize; }
// inline bool isValid() const { return m_tag > 0 && m_data.size() >= kMinSize; }
// HSC taddrs are length 34
inline bool isValid() const { return m_data.size() >= 34; }
inline const char *data() const { return m_data; }
inline const Coin &coin() const { return tagInfo(m_tag).coin; }
inline const uint8_t *spendKey() const { return m_publicSpendKey; }

12708
src/crypto/cn/sse2neon.h

File diff suppressed because it is too large

13
src/crypto/randomx/randomx.cpp

@ -86,6 +86,18 @@ RandomX_ConfigurationArqma::RandomX_ConfigurationArqma()
ScratchpadL3_Size = 262144;
}
// These settings are compatible with all Hush Smart Chains by default
// For more info: https://hush.is/hsc-creator
// https://git.hush.is/hush/hush3/src/branch/dragonx/doc/randomx.md
RandomX_ConfigurationDragonX::RandomX_ConfigurationDragonX()
{
ArgonIterations = 5;
ArgonSalt = "RandomXHUSH\x03";
ProgramSize = 512;
ProgramIterations = 4096;
ProgramCount = 16;
}
RandomX_ConfigurationGraft::RandomX_ConfigurationGraft()
{
ArgonLanes = 2;
@ -358,6 +370,7 @@ RandomX_ConfigurationArqma RandomX_ArqmaConfig;
RandomX_ConfigurationGraft RandomX_GraftConfig;
RandomX_ConfigurationSafex RandomX_SafexConfig;
RandomX_ConfigurationKeva RandomX_KevaConfig;
RandomX_ConfigurationDragonX RandomX_DragonXConfig;
alignas(64) RandomX_ConfigurationBase RandomX_CurrentConfig;

2
src/crypto/randomx/randomx.h

@ -147,6 +147,7 @@ struct RandomX_ConfigurationArqma : public RandomX_ConfigurationBase { RandomX_C
struct RandomX_ConfigurationGraft : public RandomX_ConfigurationBase { RandomX_ConfigurationGraft(); };
struct RandomX_ConfigurationSafex : public RandomX_ConfigurationBase { RandomX_ConfigurationSafex(); };
struct RandomX_ConfigurationKeva : public RandomX_ConfigurationBase { RandomX_ConfigurationKeva(); };
struct RandomX_ConfigurationDragonX : public RandomX_ConfigurationBase { RandomX_ConfigurationDragonX(); };
extern RandomX_ConfigurationMonero RandomX_MoneroConfig;
extern RandomX_ConfigurationWownero RandomX_WowneroConfig;
@ -154,6 +155,7 @@ extern RandomX_ConfigurationArqma RandomX_ArqmaConfig;
extern RandomX_ConfigurationGraft RandomX_GraftConfig;
extern RandomX_ConfigurationSafex RandomX_SafexConfig;
extern RandomX_ConfigurationKeva RandomX_KevaConfig;
extern RandomX_ConfigurationDragonX RandomX_DragonXConfig;
extern RandomX_ConfigurationBase RandomX_CurrentConfig;

4
src/crypto/rx/RxAlgo.cpp

@ -2,6 +2,7 @@
* Copyright (c) 2018-2019 tevador <tevador@gmail.com>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2022 Duke Leto <https://git.hush.is/duke>
*
* 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
@ -47,6 +48,9 @@ const RandomX_ConfigurationBase *xmrig::RxAlgo::base(Algorithm::Id algorithm)
case Algorithm::RX_KEVA:
return &RandomX_KevaConfig;
case Algorithm::RX_DRAGONX:
return &RandomX_DragonXConfig;
default:
break;
}

18
src/donate.h

@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2022 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2022 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@ -23,22 +23,22 @@
/*
* Dev donation.
*
* Percentage of your hashing power that you want to donate to the developer, can be 0 if you don't want to do that.
* Percentage of your hashing power that you want to donate to the developer can be 0% but supports XMRig Development.
*
* Example of how it works for the setting of 1%:
* You miner will mine into your usual pool for random time (in range from 49.5 to 148.5 minutes),
* Your miner will mine into your usual pool for a random time (in a range from 49.5 to 148.5 minutes),
* then switch to the developer's pool for 1 minute, then switch again to your pool for 99 minutes
* and then switch again to developer's pool for 1 minute, these rounds will continue until miner working.
* and then switch again to developer's pool for 1 minute; these rounds will continue until the miner stops.
*
* Randomised only first round, to prevent waves on the donation pool.
* Randomised only on the first round to prevent waves on the donation pool.
*
* Switching is instant, and only happens after a successful connection, so you never loose any hashes.
* Switching is instant and only happens after a successful connection, so you never lose any hashes.
*
* If you plan on changing this setting to 0 please consider making a one off donation to my wallet:
* If you plan on changing donations to 0%, please consider making a one-off donation to my wallet:
* XMR: 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD
*/
constexpr const int kDefaultDonateLevel = 1;
constexpr const int kMinimumDonateLevel = 1;
#endif /* XMRIG_DONATE_H */
#endif // XMRIG_DONATE_H

4
src/version.h

@ -22,7 +22,7 @@
#define APP_ID "xmrig"
#define APP_NAME "XMRig"
#define APP_DESC "XMRig miner"
#define APP_VERSION "6.18.1"
#define APP_VERSION "6.18.2-dev"
#define APP_DOMAIN "xmrig.com"
#define APP_SITE "www.xmrig.com"
#define APP_COPYRIGHT "Copyright (C) 2016-2022 xmrig.com"
@ -30,7 +30,7 @@
#define APP_VER_MAJOR 6
#define APP_VER_MINOR 18
#define APP_VER_PATCH 1
#define APP_VER_PATCH 2
#ifdef _MSC_VER
# if (_MSC_VER >= 1930)

Loading…
Cancel
Save