What changed, and why it matters
This commit changes how the XMRig miner handles a new RandomX variant (RandomX v2). Previously, when switching to or from RandomX v2, the miner would regenerate its large dataset. Now it reuses the existing dataset, treating RandomX v2 and the original RandomX as having the same 'seed algorithm.' This is a performance/correctness optimization for a new algorithm variant, not a fix for an exploitable security vulnerability.
No immediate security action required. Treat as routine mining algorithm update. If deploying, verify RandomX v2 hashing produces correct results and performance is as expected.
Security signals we found
Algorithm family equivalence logic change
Dataset initialization path modified
No input validation changes
No memory safety fixes
No privilege or authentication changes
Evidence from the diff
The patch modifies RandomX dataset initialization logic. In Miner.cpp, setJob() now calls RxAlgo::apply(job.algorithm()) when the algorithm changes within the RandomX family, instead of only checking Rx::isReady(). In RxSeed.h, equality comparison now treats Algorithm::RX_0 and Algorithm::RX_V2 as equivalent for seed/dataset purposes. This avoids unnecessary dataset regeneration when switching between RX_0 and RX_V2, which share the same dataset requirements. The change appears to be a correctness/performance fix for RandomX v2 support rather than a security patch.
Changed components
src/core/Miner.cppsrc/crypto/rx/RxSeed.hRandomX algorithm handlingInspect captured patch +12 / −4
### src/core/Miner.cpp
@@ -59,6 +59,7 @@
# include "crypto/rx/Profiler.h"
# include "crypto/rx/Rx.h"
# include "crypto/rx/RxConfig.h"
+# include "crypto/rx/RxAlgo.h"
#endif
@@ -556,11 +557,12 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
}
# ifdef XMRIG_ALGO_RANDOMX
- if (job.algorithm().family() == Algorithm::RANDOM_X && !Rx::isReady(job)) {
+ if (job.algorithm().family() == Algorithm::RANDOM_X) {
if (d_ptr->algorithm != job.algorithm()) {
stop();
+ RxAlgo::apply(job.algorithm());
}
- else {
+ else if (!Rx::isReady(job)) {
Nonce::pause(true);
Nonce::touch();
}
### src/crypto/rx/RxSeed.h
@@ -47,8 +47,8 @@ class RxSeed
inline RxSeed(const Algorithm &algorithm, const Buffer &seed) : m_algorithm(algorithm), m_data(seed) {}
inline RxSeed(const Job &job) : m_algorithm(job.algorithm()), m_data(job.seed()) {}
- inline bool isEqual(const Job &job) const { return m_algorithm == job.algorithm() && m_data == job.seed(); }
- inline bool isEqual(const RxSeed &other) const { return m_algorithm == other.m_algorithm && m_data == other.m_data; }
+ inline bool isEqual(const Job &job) const { return isEqualSeedAlgo(job.algorithm()) && m_data == job.seed(); }
+ inline bool isEqual(const RxSeed &other) const { return isEqualSeedAlgo(other.m_algorithm) && m_data == other.m_data; }
inline const Algorithm &algorithm() const { return m_algorithm; }
inline const Buffer &data() const { return m_data; }
@@ -60,6 +60,12 @@ class RxSeed
private:
Algorithm m_algorithm;
Buffer m_data;
+
+ inline bool isEqualSeedAlgo(Algorithm other) const {
+ return (m_algorithm == other) ||
+ ((m_algorithm == Algorithm::RX_0) && (other == Algorithm::RX_V2)) ||
+ ((m_algorithm == Algorithm::RX_V2) && (other == Algorithm::RX_0));
+ }
};
Why this scored 26/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.