From 5f6bcfe9491611af0bb267e1e6cabbaf07eec27b Mon Sep 17 00:00:00 2001 From: Matthew Vogel Date: Wed, 31 Jul 2024 23:26:37 -0700 Subject: [PATCH 1/4] add yada constants --- src/base/crypto/Coin.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/base/crypto/Coin.cpp b/src/base/crypto/Coin.cpp index 6452e7a7..f05d6d24 100644 --- a/src/base/crypto/Coin.cpp +++ b/src/base/crypto/Coin.cpp @@ -54,6 +54,7 @@ static const CoinInfo coinInfo[] = { { Algorithm::RX_WOW, "WOW", "Wownero", 300, 100000000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " wownero ") }, { Algorithm::RX_0, "ZEPH", "Zephyr", 120, 1000000000000, BLUE_BG_BOLD( WHITE_BOLD_S " zephyr ") }, { Algorithm::RX_0, "Townforge","Townforge", 30, 100000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " townforge ") }, + { Algorithm::RX_YADA, "YDA", "YadaCoin", 120, 100000000, BLUE_BG_BOLD( WHITE_BOLD_S " yadacoin ") }, }; From 5342f25fbfb37ecc14272f0c91835f8d00817376 Mon Sep 17 00:00:00 2001 From: Matthew Vogel Date: Wed, 31 Jul 2024 23:45:34 -0700 Subject: [PATCH 2/4] update constants for yadacoin --- src/backend/cpu/CpuConfig_gen.h | 5 +++++ src/base/crypto/Algorithm.cpp | 6 +++++- src/base/crypto/Algorithm.h | 1 + src/base/crypto/Coin.h | 3 ++- src/base/net/stratum/Job.cpp | 19 ++++++++++++------- src/crypto/randomx/randomx.cpp | 8 ++++++++ src/crypto/randomx/randomx.h | 2 ++ src/crypto/rx/RxAlgo.cpp | 3 +++ 8 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/backend/cpu/CpuConfig_gen.h b/src/backend/cpu/CpuConfig_gen.h index d28cc955..28b1cefd 100644 --- a/src/backend/cpu/CpuConfig_gen.h +++ b/src/backend/cpu/CpuConfig_gen.h @@ -126,6 +126,11 @@ size_t inline generate(Threads &threads, uint32 count += threads.move(Algorithm::kRX_WOW, std::move(wow)); } + if (!threads.isExist(Algorithm::RX_YADA)) { + auto yada = cpuInfo->threads(Algorithm::RX_YADA, limit); + count += threads.move(Algorithm::kRX_YADA, std::move(yada)); + } + count += generate(Algorithm::kRX, threads, Algorithm::RX_0, limit); return count; diff --git a/src/base/crypto/Algorithm.cpp b/src/base/crypto/Algorithm.cpp index b7ea908a..e7c4f551 100644 --- a/src/base/crypto/Algorithm.cpp +++ b/src/base/crypto/Algorithm.cpp @@ -81,6 +81,7 @@ const char *Algorithm::kRX_WOW = "rx/wow"; 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_YADA = "rx/yada"; #endif #ifdef XMRIG_ALGO_ARGON2 @@ -146,6 +147,7 @@ static const std::map kAlgorithmNames = { ALGO_NAME(RX_ARQ), ALGO_NAME(RX_GRAFT), ALGO_NAME(RX_SFX), + ALGO_NAME(RX_YADA), # endif # ifdef XMRIG_ALGO_ARGON2 @@ -259,6 +261,8 @@ static const std::map kAlgorithmAlias ALGO_ALIAS(RX_GRAFT, "randomgraft"), ALGO_ALIAS_AUTO(RX_SFX), ALGO_ALIAS(RX_SFX, "randomx/sfx"), ALGO_ALIAS(RX_SFX, "randomsfx"), + ALGO_ALIAS_AUTO(RX_YADA), ALGO_ALIAS(RX_YADA, "randomx/yada"), + ALGO_ALIAS(RX_YADA, "randomyada"), # endif # ifdef XMRIG_ALGO_ARGON2 @@ -346,7 +350,7 @@ std::vector xmrig::Algorithm::all(const std::function(raw.data()))); - } - else if (size == 8) { - m_target = *reinterpret_cast(raw.data()); + if (algorithm() == Algorithm::RX_YADA) { + m_target = strtoull(target, nullptr, 16); } else { - return false; + if (size == 4) { + m_target = 0xFFFFFFFFFFFFFFFFULL / (0xFFFFFFFFULL / uint64_t(*reinterpret_cast(raw.data()))); + } + else if (size == 8) { + m_target = *reinterpret_cast(raw.data()); + } + else { + return false; + } } # ifdef XMRIG_PROXY_PROJECT @@ -176,6 +180,7 @@ int32_t xmrig::Job::nonceOffset() const auto f = algorithm().family(); if (f == Algorithm::KAWPOW) return 32; if (f == Algorithm::GHOSTRIDER) return 76; + if (f == Algorithm::RX_YADA) return 147; return 39; } diff --git a/src/crypto/randomx/randomx.cpp b/src/crypto/randomx/randomx.cpp index 7e0e50cd..adfec8a9 100644 --- a/src/crypto/randomx/randomx.cpp +++ b/src/crypto/randomx/randomx.cpp @@ -100,6 +100,13 @@ RandomX_ConfigurationSafex::RandomX_ConfigurationSafex() ArgonSalt = "RandomSFX\x01"; } +RandomX_ConfigurationYada::RandomX_ConfigurationYada() +{ + ArgonSalt = "RandomXYadaCoin\x03"; + SuperscalarLatency = 150; + ArgonIterations = 4; +} + RandomX_ConfigurationBase::RandomX_ConfigurationBase() : ArgonIterations(3) , ArgonLanes(1) @@ -350,6 +357,7 @@ RandomX_ConfigurationWownero RandomX_WowneroConfig; RandomX_ConfigurationArqma RandomX_ArqmaConfig; RandomX_ConfigurationGraft RandomX_GraftConfig; RandomX_ConfigurationSafex RandomX_SafexConfig; +RandomX_ConfigurationYada RandomX_YadaConfig; alignas(64) RandomX_ConfigurationBase RandomX_CurrentConfig; diff --git a/src/crypto/randomx/randomx.h b/src/crypto/randomx/randomx.h index 80aad66b..6e7875a9 100644 --- a/src/crypto/randomx/randomx.h +++ b/src/crypto/randomx/randomx.h @@ -146,12 +146,14 @@ struct RandomX_ConfigurationWownero : public RandomX_ConfigurationBase { RandomX struct RandomX_ConfigurationArqma : public RandomX_ConfigurationBase { RandomX_ConfigurationArqma(); }; struct RandomX_ConfigurationGraft : public RandomX_ConfigurationBase { RandomX_ConfigurationGraft(); }; struct RandomX_ConfigurationSafex : public RandomX_ConfigurationBase { RandomX_ConfigurationSafex(); }; +struct RandomX_ConfigurationYada : public RandomX_ConfigurationBase { RandomX_ConfigurationYada(); }; extern RandomX_ConfigurationMonero RandomX_MoneroConfig; extern RandomX_ConfigurationWownero RandomX_WowneroConfig; extern RandomX_ConfigurationArqma RandomX_ArqmaConfig; extern RandomX_ConfigurationGraft RandomX_GraftConfig; extern RandomX_ConfigurationSafex RandomX_SafexConfig; +extern RandomX_ConfigurationYada RandomX_YadaConfig; extern RandomX_ConfigurationBase RandomX_CurrentConfig; diff --git a/src/crypto/rx/RxAlgo.cpp b/src/crypto/rx/RxAlgo.cpp index 7399afe7..0de9694b 100644 --- a/src/crypto/rx/RxAlgo.cpp +++ b/src/crypto/rx/RxAlgo.cpp @@ -44,6 +44,9 @@ const RandomX_ConfigurationBase *xmrig::RxAlgo::base(Algorithm::Id algorithm) case Algorithm::RX_SFX: return &RandomX_SafexConfig; + case Algorithm::RX_YADA: + return &RandomX_YadaConfig; + default: break; } From 046b2a17d3b32ad278cc7c7df51a071ccf374b6a Mon Sep 17 00:00:00 2001 From: Matthew Vogel Date: Thu, 1 Aug 2024 00:01:09 -0700 Subject: [PATCH 3/4] finish updating for yadacoin --- src/base/crypto/Algorithm.h | 1 + src/base/crypto/Coin.h | 2 +- src/crypto/randomx/randomx.cpp | 1 + src/crypto/randomx/randomx.h | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/base/crypto/Algorithm.h b/src/base/crypto/Algorithm.h index 2b3b2348..53276068 100644 --- a/src/base/crypto/Algorithm.h +++ b/src/base/crypto/Algorithm.h @@ -143,6 +143,7 @@ public: static const char *kRX_ARQ; static const char *kRX_GRAFT; static const char *kRX_SFX; + static const char *kRX_YADA; # endif # ifdef XMRIG_ALGO_ARGON2 diff --git a/src/base/crypto/Coin.h b/src/base/crypto/Coin.h index cb28613f..c3c97fda 100644 --- a/src/base/crypto/Coin.h +++ b/src/base/crypto/Coin.h @@ -40,8 +40,8 @@ public: WOWNERO, ZEPHYR, TOWNFORGE, - MAX, YADA, + MAX }; static const char *kDisabled; diff --git a/src/crypto/randomx/randomx.cpp b/src/crypto/randomx/randomx.cpp index adfec8a9..1126c7a2 100644 --- a/src/crypto/randomx/randomx.cpp +++ b/src/crypto/randomx/randomx.cpp @@ -111,6 +111,7 @@ RandomX_ConfigurationBase::RandomX_ConfigurationBase() : ArgonIterations(3) , ArgonLanes(1) , ArgonSalt("RandomX\x03") + , SuperscalarLatency(170) , ScratchpadL1_Size(16384) , ScratchpadL2_Size(262144) , ScratchpadL3_Size(2097152) diff --git a/src/crypto/randomx/randomx.h b/src/crypto/randomx/randomx.h index 6e7875a9..30e47368 100644 --- a/src/crypto/randomx/randomx.h +++ b/src/crypto/randomx/randomx.h @@ -69,7 +69,6 @@ struct RandomX_ConfigurationBase { ArgonMemory = 262144, CacheAccesses = 8, - SuperscalarLatency = 170, DatasetBaseSize = 2147483648, DatasetExtraSize = 33554368, JumpBits = 8, @@ -82,6 +81,7 @@ struct RandomX_ConfigurationBase uint32_t ArgonIterations; uint32_t ArgonLanes; const char* ArgonSalt; + uint32_t SuperscalarLatency; uint32_t ScratchpadL1_Size; uint32_t ScratchpadL2_Size; From b108845627d5ef7cfa036d9feb3cd650c05ffb63 Mon Sep 17 00:00:00 2001 From: Matthew Vogel Date: Thu, 1 Aug 2024 15:10:20 -0700 Subject: [PATCH 4/4] fix yada nonce offset --- src/base/crypto/Coin.cpp | 2 +- src/base/net/stratum/Job.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/base/crypto/Coin.cpp b/src/base/crypto/Coin.cpp index f05d6d24..85cc605a 100644 --- a/src/base/crypto/Coin.cpp +++ b/src/base/crypto/Coin.cpp @@ -54,7 +54,7 @@ static const CoinInfo coinInfo[] = { { Algorithm::RX_WOW, "WOW", "Wownero", 300, 100000000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " wownero ") }, { Algorithm::RX_0, "ZEPH", "Zephyr", 120, 1000000000000, BLUE_BG_BOLD( WHITE_BOLD_S " zephyr ") }, { Algorithm::RX_0, "Townforge","Townforge", 30, 100000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " townforge ") }, - { Algorithm::RX_YADA, "YDA", "YadaCoin", 120, 100000000, BLUE_BG_BOLD( WHITE_BOLD_S " yadacoin ") }, + { Algorithm::RX_YADA, "YDA", "YadaCoin", 120, 100000000, BLUE_BG_BOLD( WHITE_BOLD_S " yada ") }, }; diff --git a/src/base/net/stratum/Job.cpp b/src/base/net/stratum/Job.cpp index 9e035622..da5d7e2b 100644 --- a/src/base/net/stratum/Job.cpp +++ b/src/base/net/stratum/Job.cpp @@ -180,7 +180,10 @@ int32_t xmrig::Job::nonceOffset() const auto f = algorithm().family(); if (f == Algorithm::KAWPOW) return 32; if (f == Algorithm::GHOSTRIDER) return 76; - if (f == Algorithm::RX_YADA) return 147; + + auto id = algorithm().id(); + if (id == Algorithm::RX_YADA) return 147; + return 39; }