From d4aa0b6bfa4d4c965425250a0a051e8c1c902497 Mon Sep 17 00:00:00 2001 From: Some Random Crypto Guy Date: Fri, 8 Aug 2025 08:50:46 +0100 Subject: [PATCH] fixed iOS RandomX issue (thanks Julian & Cypher Stack) --- patches/salvium/0016-ios_no_random_JIT.patch | 41 ++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 patches/salvium/0016-ios_no_random_JIT.patch diff --git a/patches/salvium/0016-ios_no_random_JIT.patch b/patches/salvium/0016-ios_no_random_JIT.patch new file mode 100644 index 0000000..76d1ab5 --- /dev/null +++ b/patches/salvium/0016-ios_no_random_JIT.patch @@ -0,0 +1,41 @@ +Subject: [PATCH] ios no randomx JIT +From: julian +--- +Index: src/cryptonote_core/cryptonote_tx_utils.cpp +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp +--- a/src/cryptonote_core/cryptonote_tx_utils.cpp (revision f9f0a43b1f5d9ec9f444bafa88073f1ddaf6e344) ++++ b/src/cryptonote_core/cryptonote_tx_utils.cpp (date 1752524175340) +@@ -1296,16 +1296,24 @@ + + bool get_block_longhash(const Blockchain *pbc, const blobdata& bd, crypto::hash& res, const uint64_t height, const int major_version, const crypto::hash *seed_hash, const int miners) + { +- crypto::hash hash; + if (pbc != NULL) + { ++ crypto::hash hash; + const uint64_t seed_height = rx_seedheight(height); + hash = seed_hash ? *seed_hash : pbc->get_pending_block_id_by_height(seed_height); +- } else +- { +- memset(&hash, 0, sizeof(hash)); // only happens when generating genesis block +- } +- rx_slow_hash(hash.data, bd.data(), bd.size(), res.data); ++ rx_slow_hash(hash.data, bd.data(), bd.size(), res.data); ++ } else ++ { ++ // only happens when generating genesis block ++ // Hardcoded genesis for ios compat ++ const char* hex = "4ade63d5ccb8cfae075e8b882514c471f35da95f85dd1b20fdcd6f3a95caabc5"; ++ char bytes[32]; ++ for (int i = 0; i < 32; i++) { ++ char byte_str[3] = { hex[i * 2], hex[i * 2 + 1], '\0' }; ++ bytes[i] = (char)strtol(byte_str, NULL, 16); ++ } ++ memcpy(res.data, bytes, sizeof(bytes)); ++ } + return true; + }