Skip to content

Commit 926d2a3

Browse files
committed
Merge branch 'dev'
2 parents 4e565a3 + 88d2190 commit 926d2a3

40 files changed

+612
-255
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v6.18.0
2+
- Sync changes with XMRig v6.18.0
3+
- [#499](https://github.com/xmrig/xmrig-proxy/pull/499) Fixed socket and memory leak.
4+
15
# v6.15.1
26
- [#2586](https://github.com/xmrig/xmrig/pull/2586) Fixed Windows 7 compatibility.
37

src/base/base.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ set(HEADERS_BASE
6868
src/base/net/tools/MemPool.h
6969
src/base/net/tools/NetBuffer.h
7070
src/base/net/tools/Storage.h
71+
src/base/tools/Alignment.h
7172
src/base/tools/Arguments.h
7273
src/base/tools/Baton.h
7374
src/base/tools/bswap_64.h
@@ -132,6 +133,7 @@ set(SOURCES_BASE
132133
src/base/net/tools/LineReader.cpp
133134
src/base/net/tools/NetBuffer.cpp
134135
src/base/tools/Arguments.cpp
136+
src/base/tools/Chrono.cpp
135137
src/base/tools/cryptonote/BlockTemplate.cpp
136138
src/base/tools/cryptonote/crypto-ops-data.c
137139
src/base/tools/cryptonote/crypto-ops.c
@@ -244,7 +246,7 @@ else()
244246
endif()
245247

246248

247-
if (WITH_KAWPOW)
249+
if (WITH_KAWPOW OR WITH_GHOSTRIDER)
248250
list(APPEND HEADERS_BASE
249251
src/base/net/stratum/AutoClient.h
250252
src/base/net/stratum/EthStratumClient.h

src/base/crypto/Algorithm.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,16 @@ const char *Algorithm::kAR2_CHUKWA_V2 = "argon2/chukwav2";
9191
const char *Algorithm::kAR2_WRKZ = "argon2/ninja";
9292
#endif
9393

94-
#ifdef XMRIG_ALGO_ASTROBWT
95-
const char *Algorithm::kASTROBWT = "astrobwt";
96-
const char *Algorithm::kASTROBWT_DERO = "astrobwt";
97-
#endif
98-
9994
#ifdef XMRIG_ALGO_KAWPOW
10095
const char *Algorithm::kKAWPOW = "kawpow";
10196
const char *Algorithm::kKAWPOW_RVN = "kawpow";
10297
#endif
10398

99+
#ifdef XMRIG_ALGO_GHOSTRIDER
100+
const char* Algorithm::kGHOSTRIDER = "ghostrider";
101+
const char* Algorithm::kGHOSTRIDER_RTM = "ghostrider";
102+
#endif
103+
104104

105105
#define ALGO_NAME(ALGO) { Algorithm::ALGO, Algorithm::k##ALGO }
106106
#define ALGO_ALIAS(ALGO, NAME) { NAME, Algorithm::ALGO }
@@ -156,13 +156,13 @@ static const std::map<uint32_t, const char *> kAlgorithmNames = {
156156
ALGO_NAME(AR2_WRKZ),
157157
# endif
158158

159-
# ifdef XMRIG_ALGO_ASTROBWT
160-
ALGO_NAME(ASTROBWT_DERO),
161-
# endif
162-
163159
# ifdef XMRIG_ALGO_KAWPOW
164160
ALGO_NAME(KAWPOW_RVN),
165161
# endif
162+
163+
# ifdef XMRIG_ALGO_GHOSTRIDER
164+
ALGO_NAME(GHOSTRIDER_RTM),
165+
# endif
166166
};
167167

168168

@@ -271,13 +271,14 @@ static const std::map<const char *, Algorithm::Id, aliasCompare> kAlgorithmAlias
271271
ALGO_ALIAS_AUTO(AR2_WRKZ), ALGO_ALIAS(AR2_WRKZ, "argon2/wrkz"),
272272
# endif
273273

274-
# ifdef XMRIG_ALGO_ASTROBWT
275-
ALGO_ALIAS_AUTO(ASTROBWT_DERO), ALGO_ALIAS(ASTROBWT_DERO, "astrobwt/dero"),
276-
# endif
277-
278274
# ifdef XMRIG_ALGO_KAWPOW
279275
ALGO_ALIAS_AUTO(KAWPOW_RVN), ALGO_ALIAS(KAWPOW_RVN, "kawpow/rvn"),
280276
# endif
277+
278+
# ifdef XMRIG_ALGO_GHOSTRIDER
279+
ALGO_ALIAS_AUTO(GHOSTRIDER_RTM), ALGO_ALIAS(GHOSTRIDER_RTM, "ghostrider/rtm"),
280+
ALGO_ALIAS(GHOSTRIDER_RTM, "gr"),
281+
# endif
281282
};
282283

283284

@@ -351,8 +352,8 @@ std::vector<xmrig::Algorithm> xmrig::Algorithm::all(const std::function<bool(con
351352
CN_UPX2,
352353
RX_0, RX_WOW, RX_ARQ, RX_GRAFT, RX_SFX, RX_KEVA,
353354
AR2_CHUKWA, AR2_CHUKWA_V2, AR2_WRKZ,
354-
ASTROBWT_DERO,
355-
KAWPOW_RVN
355+
KAWPOW_RVN,
356+
GHOSTRIDER_RTM
356357
};
357358

358359
Algorithms out;

src/base/crypto/Algorithm.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ class Algorithm
6565
CN_PICO_0 = 0x63120200, // "cn-pico" CryptoNight-Pico
6666
CN_PICO_TLO = 0x63120274, // "cn-pico/tlo" CryptoNight-Pico (TLO)
6767
CN_UPX2 = 0x63110200, // "cn/upx2" Uplexa (UPX2)
68+
CN_GR_0 = 0x63130100, // "cn/dark" GhostRider
69+
CN_GR_1 = 0x63130101, // "cn/dark-lite" GhostRider
70+
CN_GR_2 = 0x63150102, // "cn/fast" GhostRider
71+
CN_GR_3 = 0x63140103, // "cn/lite" GhostRider
72+
CN_GR_4 = 0x63120104, // "cn/turtle" GhostRider
73+
CN_GR_5 = 0x63120105, // "cn/turtle-lite" GhostRider
74+
GHOSTRIDER_RTM = 0x6c150000, // "ghostrider" GhostRider
6875
RX_0 = 0x72151200, // "rx/0" RandomX (reference configuration).
6976
RX_WOW = 0x72141177, // "rx/wow" RandomWOW (Wownero).
7077
RX_ARQ = 0x72121061, // "rx/arq" RandomARQ (Arqma).
@@ -74,7 +81,6 @@ class Algorithm
7481
AR2_CHUKWA = 0x61130000, // "argon2/chukwa" Argon2id (Chukwa).
7582
AR2_CHUKWA_V2 = 0x61140000, // "argon2/chukwav2" Argon2id (Chukwa v2).
7683
AR2_WRKZ = 0x61120000, // "argon2/wrkz" Argon2id (WRKZ)
77-
ASTROBWT_DERO = 0x41000000, // "astrobwt" AstroBWT (Dero)
7884
KAWPOW_RVN = 0x6b0f0000, // "kawpow/rvn" KawPow (RVN)
7985
};
8086

@@ -88,8 +94,8 @@ class Algorithm
8894
CN_FEMTO = 0x63110000,
8995
RANDOM_X = 0x72000000,
9096
ARGON2 = 0x61000000,
91-
ASTROBWT = 0x41000000,
92-
KAWPOW = 0x6b000000
97+
KAWPOW = 0x6b000000,
98+
GHOSTRIDER = 0x6c000000
9399
};
94100

95101
static const char *kINVALID;
@@ -147,16 +153,16 @@ class Algorithm
147153
static const char *kAR2_WRKZ;
148154
# endif
149155

150-
# ifdef XMRIG_ALGO_ASTROBWT
151-
static const char *kASTROBWT;
152-
static const char *kASTROBWT_DERO;
153-
# endif
154-
155156
# ifdef XMRIG_ALGO_KAWPOW
156157
static const char *kKAWPOW;
157158
static const char *kKAWPOW_RVN;
158159
# endif
159160

161+
# ifdef XMRIG_ALGO_GHOSTRIDER
162+
static const char* kGHOSTRIDER;
163+
static const char* kGHOSTRIDER_RTM;
164+
# endif
165+
160166
inline Algorithm() = default;
161167
inline Algorithm(const char *algo) : m_id(parse(algo)) {}
162168
inline Algorithm(Id id) : m_id(id) {}
@@ -176,16 +182,10 @@ class Algorithm
176182
inline Id id() const { return m_id; }
177183
inline size_t l2() const { return l2(m_id); }
178184
inline uint32_t family() const { return family(m_id); }
179-
inline uint32_t maxIntensity() const { return isCN() ? 5 : 1; };
180-
181-
inline size_t l3() const
182-
{
183-
# ifdef XMRIG_ALGO_ASTROBWT
184-
return m_id != ASTROBWT_DERO ? l3(m_id) : 0x100000 * 20;
185-
# else
186-
return l3(m_id);
187-
# endif
188-
}
185+
inline uint32_t minIntensity() const { return ((m_id == GHOSTRIDER_RTM) ? 8 : 1); };
186+
inline uint32_t maxIntensity() const { return isCN() ? 5 : ((m_id == GHOSTRIDER_RTM) ? 8 : 1); };
187+
188+
inline size_t l3() const { return l3(m_id); }
189189

190190
inline bool operator!=(Algorithm::Id id) const { return m_id != id; }
191191
inline bool operator!=(const Algorithm &other) const { return !isEqual(other); }

src/base/crypto/Coin.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,14 @@ struct CoinInfo
4545

4646

4747
static const CoinInfo coinInfo[] = {
48-
{ Algorithm::INVALID, nullptr, nullptr, 0, 0, nullptr },
49-
{ Algorithm::RX_0, "XMR", "Monero", 120, 1000000000000, YELLOW_BG_BOLD( WHITE_BOLD_S " monero ") },
50-
{ Algorithm::CN_R, "SUMO", "Sumokoin", 240, 1000000000, BLUE_BG_BOLD( WHITE_BOLD_S " sumo ") },
51-
{ Algorithm::RX_ARQ, "ARQ", "ArQmA", 120, 1000000000, BLUE_BG_BOLD( WHITE_BOLD_S " arqma ") },
52-
{ Algorithm::ASTROBWT_DERO, "DERO", "DERO", 0, 0, BLUE_BG_BOLD( WHITE_BOLD_S " dero ") },
53-
{ Algorithm::RX_GRAFT, "GRFT", "Graft", 120, 10000000000, BLUE_BG_BOLD( WHITE_BOLD_S " graft ") },
54-
{ Algorithm::RX_KEVA, "KVA", "Kevacoin", 0, 0, MAGENTA_BG_BOLD(WHITE_BOLD_S " keva ") },
55-
{ Algorithm::KAWPOW_RVN, "RVN", "Ravencoin", 0, 0, BLUE_BG_BOLD( WHITE_BOLD_S " raven ") },
56-
{ Algorithm::RX_WOW, "WOW", "Wownero", 300, 100000000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " wownero ") },
48+
{ Algorithm::INVALID, nullptr, nullptr, 0, 0, nullptr },
49+
{ Algorithm::RX_0, "XMR", "Monero", 120, 1000000000000, YELLOW_BG_BOLD( WHITE_BOLD_S " monero ") },
50+
{ Algorithm::CN_R, "SUMO", "Sumokoin", 240, 1000000000, BLUE_BG_BOLD( WHITE_BOLD_S " sumo ") },
51+
{ Algorithm::RX_ARQ, "ARQ", "ArQmA", 120, 1000000000, BLUE_BG_BOLD( WHITE_BOLD_S " arqma ") },
52+
{ Algorithm::RX_GRAFT, "GRFT", "Graft", 120, 10000000000, BLUE_BG_BOLD( WHITE_BOLD_S " graft ") },
53+
{ Algorithm::RX_KEVA, "KVA", "Kevacoin", 0, 0, MAGENTA_BG_BOLD(WHITE_BOLD_S " keva ") },
54+
{ Algorithm::KAWPOW_RVN, "RVN", "Ravencoin", 0, 0, BLUE_BG_BOLD( WHITE_BOLD_S " raven ") },
55+
{ Algorithm::RX_WOW, "WOW", "Wownero", 300, 100000000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " wownero ") },
5756
};
5857

5958

src/base/crypto/Coin.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class Coin
3535
MONERO,
3636
SUMO,
3737
ARQMA,
38-
DERO,
3938
GRAFT,
4039
KEVA,
4140
RAVEN,

src/base/crypto/keccak.cpp

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737
#define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y))))
3838
#endif
3939

40-
const uint64_t keccakf_rndc[24] =
40+
const uint64_t keccakf_rndc[24] =
4141
{
4242
0x0000000000000001, 0x0000000000008082, 0x800000000000808a,
4343
0x8000000080008000, 0x000000000000808b, 0x0000000080000001,
4444
0x8000000080008081, 0x8000000000008009, 0x000000000000008a,
4545
0x0000000000000088, 0x0000000080008009, 0x000000008000000a,
4646
0x000000008000808b, 0x800000000000008b, 0x8000000000008089,
47-
0x8000000000008003, 0x8000000000008002, 0x8000000000000080,
47+
0x8000000000008003, 0x8000000000008002, 0x8000000000000080,
4848
0x000000000000800a, 0x800000008000000a, 0x8000000080008081,
4949
0x8000000000008080, 0x0000000080000001, 0x8000000080008008
5050
};
@@ -53,10 +53,8 @@ const uint64_t keccakf_rndc[24] =
5353

5454
void xmrig::keccakf(uint64_t st[25], int rounds)
5555
{
56-
int i, j, round;
57-
uint64_t t, bc[5];
58-
59-
for (round = 0; round < rounds; ++round) {
56+
for (int round = 0; round < rounds; ++round) {
57+
uint64_t bc[5];
6058

6159
// Theta
6260
bc[0] = st[0] ^ st[5] ^ st[10] ^ st[15] ^ st[20];
@@ -65,17 +63,21 @@ void xmrig::keccakf(uint64_t st[25], int rounds)
6563
bc[3] = st[3] ^ st[8] ^ st[13] ^ st[18] ^ st[23];
6664
bc[4] = st[4] ^ st[9] ^ st[14] ^ st[19] ^ st[24];
6765

68-
for (i = 0; i < 5; ++i) {
69-
t = bc[(i + 4) % 5] ^ ROTL64(bc[(i + 1) % 5], 1);
70-
st[i ] ^= t;
71-
st[i + 5] ^= t;
72-
st[i + 10] ^= t;
73-
st[i + 15] ^= t;
74-
st[i + 20] ^= t;
66+
#define X(i) { \
67+
const uint64_t t = bc[(i + 4) % 5] ^ ROTL64(bc[(i + 1) % 5], 1); \
68+
st[i ] ^= t; \
69+
st[i + 5] ^= t; \
70+
st[i + 10] ^= t; \
71+
st[i + 15] ^= t; \
72+
st[i + 20] ^= t; \
7573
}
7674

75+
X(0); X(1); X(2); X(3); X(4);
76+
77+
#undef X
78+
7779
// Rho Pi
78-
t = st[1];
80+
const uint64_t t = st[1];
7981
st[ 1] = ROTL64(st[ 6], 44);
8082
st[ 6] = ROTL64(st[ 9], 20);
8183
st[ 9] = ROTL64(st[22], 61);
@@ -103,7 +105,7 @@ void xmrig::keccakf(uint64_t st[25], int rounds)
103105

104106
// Chi
105107
// unrolled loop, where only last iteration is different
106-
j = 0;
108+
int j = 0;
107109
bc[0] = st[j ];
108110
bc[1] = st[j + 1];
109111

@@ -155,7 +157,7 @@ void xmrig::keccakf(uint64_t st[25], int rounds)
155157
st[j + 2] ^= (~bc[3]) & bc[4];
156158
st[j + 3] ^= (~bc[4]) & bc[0];
157159
st[j + 4] ^= (~bc[0]) & bc[1];
158-
160+
159161
// Iota
160162
st[0] ^= keccakf_rndc[round];
161163
}
@@ -173,7 +175,7 @@ void xmrig::keccak(const uint8_t *in, int inlen, uint8_t *md, int mdlen)
173175

174176
rsiz = sizeof(state_t) == mdlen ? HASH_DATA_AREA : 200 - 2 * mdlen;
175177
rsizw = rsiz / 8;
176-
178+
177179
memset(st, 0, sizeof(st));
178180

179181
for ( ; inlen >= rsiz; inlen -= rsiz, in += rsiz) {

src/base/crypto/sha3.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/* -------------------------------------------------------------------------
2-
* Works when compiled for either 32-bit or 64-bit targets, optimized for
2+
* Works when compiled for either 32-bit or 64-bit targets, optimized for
33
* 64 bit.
44
*
5-
* Canonical implementation of Init/Update/Finalize for SHA-3 byte input.
5+
* Canonical implementation of Init/Update/Finalize for SHA-3 byte input.
66
*
77
* SHA3-256, SHA3-384, SHA-512 are implemented. SHA-224 can easily be added.
88
*
99
* Based on code from http://keccak.noekeon.org/ .
1010
*
11-
* I place the code that I wrote into public domain, free to use.
11+
* I place the code that I wrote into public domain, free to use.
1212
*
13-
* I would appreciate if you give credits to this work if you used it to
13+
* I would appreciate if you give credits to this work if you used it to
1414
* write or test * your code.
1515
*
1616
* Aug 2015. Andrey Jivsov. crypto@brainhub.org
@@ -32,7 +32,7 @@
3232
#define SHA3_TRACE_BUF(format, buf, l, args...)
3333
#endif
3434

35-
/*
35+
/*
3636
* This flag is used to configure "pure" Keccak, as opposed to NIST SHA3.
3737
*/
3838
#define SHA3_USE_KECCAK_FLAG 0x80000000
@@ -108,7 +108,7 @@ sha3_Update(void *priv, void const *bufIn, size_t len)
108108
SHA3_ASSERT(ctx->byteIndex < 8);
109109
SHA3_ASSERT(ctx->wordIndex < sizeof(ctx->s) / sizeof(ctx->s[0]));
110110

111-
if(len < old_tail) { /* have no complete word or haven't started
111+
if(len < old_tail) { /* have no complete word or haven't started
112112
* the word yet */
113113
SHA3_TRACE("because %d<%d, store it and return", (unsigned)len,
114114
(unsigned)old_tail);
@@ -180,7 +180,7 @@ sha3_Update(void *priv, void const *bufIn, size_t len)
180180
}
181181

182182
/* This is simply the 'update' with the padding block.
183-
* The padding block is 0x01 || 0x00* || 0x80. First 0x01 and last 0x80
183+
* The padding block is 0x01 || 0x00* || 0x80. First 0x01 and last 0x80
184184
* bytes are always present, but they can be the same byte.
185185
*/
186186
void const *
@@ -214,7 +214,7 @@ sha3_Finalize(void *priv)
214214

215215
/* Return first bytes of the ctx->s. This conversion is not needed for
216216
* little-endian platforms e.g. wrap with #if !defined(__BYTE_ORDER__)
217-
* || !defined(__ORDER_LITTLE_ENDIAN__) || __BYTE_ORDER__!=__ORDER_LITTLE_ENDIAN__
217+
* || !defined(__ORDER_LITTLE_ENDIAN__) || __BYTE_ORDER__!=__ORDER_LITTLE_ENDIAN__
218218
* ... the conversion below ...
219219
* #endif */
220220
{

src/base/crypto/sha3.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
#define SHA3_H
33

44
/* -------------------------------------------------------------------------
5-
* Works when compiled for either 32-bit or 64-bit targets, optimized for
5+
* Works when compiled for either 32-bit or 64-bit targets, optimized for
66
* 64 bit.
77
*
8-
* Canonical implementation of Init/Update/Finalize for SHA-3 byte input.
8+
* Canonical implementation of Init/Update/Finalize for SHA-3 byte input.
99
*
1010
* SHA3-256, SHA3-384, SHA-512 are implemented. SHA-224 can easily be added.
1111
*
1212
* Based on code from http://keccak.noekeon.org/ .
1313
*
14-
* I place the code that I wrote into public domain, free to use.
14+
* I place the code that I wrote into public domain, free to use.
1515
*
16-
* I would appreciate if you give credits to this work if you used it to
16+
* I would appreciate if you give credits to this work if you used it to
1717
* write or test * your code.
1818
*
1919
* Aug 2015. Andrey Jivsov. crypto@brainhub.org
@@ -65,9 +65,9 @@ void const *sha3_Finalize(void *priv);
6565
#ifdef __cplusplus
6666
extern "C"
6767
#endif
68-
sha3_return_t sha3_HashBuffer(
68+
sha3_return_t sha3_HashBuffer(
6969
unsigned bitSize, /* 256, 384, 512 */
7070
enum SHA3_FLAGS flags, /* SHA3_FLAGS_NONE or SHA3_FLAGS_KECCAK */
71-
const void *in, unsigned inBytes,
71+
const void *in, unsigned inBytes,
7272
void *out, unsigned outBytes ); /* up to bitSize/8; truncation OK */
7373
#endif

0 commit comments

Comments
 (0)