From a1258baf5a2a318fb67626206e124db8f9ccf8ed Mon Sep 17 00:00:00 2001 From: wowario Date: Fri, 31 May 2019 12:00:30 +0300 Subject: [PATCH] add RandomWOW --- .gitmodules | 6 +++--- CMakeLists.txt | 2 +- README.md | 2 +- external/CMakeLists.txt | 2 +- external/randomwow | 1 + external/randomx | 1 - src/crypto/rx-slow-hash.c | 10 +++++----- src/cryptonote_core/blockchain.cpp | 2 ++ src/cryptonote_core/cryptonote_tx_utils.cpp | 9 +-------- 9 files changed, 15 insertions(+), 20 deletions(-) create mode 160000 external/randomwow delete mode 160000 external/randomx diff --git a/.gitmodules b/.gitmodules index f8e7c305b..afcb021af 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,6 +12,6 @@ [submodule "external/trezor-common"] path = external/trezor-common url = https://github.com/trezor/trezor-common.git -[submodule "external/randomx"] - path = external/randomx - url = https://github.com/tevador/RandomX +[submodule "external/randomwow"] + path = external/randomwow + url = https://github.com/wownero/RandomWOW diff --git a/CMakeLists.txt b/CMakeLists.txt index a1bf8dc9a..f17f705b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,7 +205,7 @@ if(NOT MANUAL_SUBMODULES) check_submodule(external/unbound) check_submodule(external/rapidjson) check_submodule(external/trezor-common) - check_submodule(external/randomx) + check_submodule(external/randomwow) endif() endif() diff --git a/README.md b/README.md index 902dc118e..58c0184fc 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Dates are provided in the format YYYY-MM-DD. | 53666 | 2018-10-06 | Cool Cage | v0.3.0.0 | v0.3.1.3 | Cryptonight variant 2, LWMA v2, ringsize = 22, MMS | 63469 | 2018-11-11 | Dank Doge | v0.4.0.0 | v0.4.0.0 | LWMA v4 | 81769 | 2019-02-19 | Erotic EggplantEmoji | v0.5.0.0 | v0.5.0.2 | Cryptonight/wow, LWMA v1 with N=144, Updated Bulletproofs, Fee Per Byte, Auto-churn -| XXXXX | 2019-XX-XX | F For Fappening | v0.6.0.0 | v0.6.0.0 | New PoW based on RandomX, new block weight algorithm, slightly more efficient RingCT format +| 114969 | 2019-06-14 | F For Fappening | v0.6.0.0 | v0.6.0.0 | RandomWOW, new block weight algorithm, slightly more efficient RingCT format X's indicate that these details have not been determined as of commit date. diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 436f29ced..e61577bd0 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -100,4 +100,4 @@ endif() add_subdirectory(db_drivers) add_subdirectory(easylogging++) -add_subdirectory(randomx) +add_subdirectory(randomwow) diff --git a/external/randomwow b/external/randomwow new file mode 160000 index 000000000..435a8382d --- /dev/null +++ b/external/randomwow @@ -0,0 +1 @@ +Subproject commit 435a8382d88cf81a85af680ff00dde7644ad4478 diff --git a/external/randomx b/external/randomx deleted file mode 160000 index 1276d67d2..000000000 --- a/external/randomx +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1276d67d2f594ea4a8e9cde28253b1a74769aeb9 diff --git a/src/crypto/rx-slow-hash.c b/src/crypto/rx-slow-hash.c index 3982ddcea..f4c068294 100644 --- a/src/crypto/rx-slow-hash.c +++ b/src/crypto/rx-slow-hash.c @@ -209,11 +209,11 @@ static void rx_initdata(randomx_cache *rs_cache, const int miners) { CTHR_THREAD_TYPE *st; si = malloc(miners * sizeof(seedinfo)); if (si == NULL) - local_abort("Couldn't allocate RandomX mining threadinfo"); + local_abort("Couldn't allocate RandomWOW mining threadinfo"); st = malloc(miners * sizeof(CTHR_THREAD_TYPE)); if (st == NULL) { free(si); - local_abort("Couldn't allocate RandomX mining threadlist"); + local_abort("Couldn't allocate RandomWOW mining threadlist"); } for (i=0; irs_cache, NULL); } if (rx_vm == NULL) - local_abort("Couldn't allocate RandomX VM"); + local_abort("Couldn't allocate RandomWOW VM"); } randomx_calculate_hash(rx_vm, data, length, hash); } @@ -333,7 +333,7 @@ void rx_slow_hash(const void *data, size_t length, char *hash, int miners) { rx_vm = randomx_create_vm(flags, rx_sp->rs_cache, rx_dataset); } if (rx_vm == NULL) - local_abort("Couldn't allocate RandomX VM"); + local_abort("Couldn't allocate RandomWOW VM"); } randomx_calculate_hash(rx_vm, data, length, hash); } diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index e66e11fe0..c202aab94 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -95,6 +95,8 @@ static const struct { { 10, 63469, 0, 1541700352 }, { 11, 81769, 0, 1549238400 }, { 12, 82069, 0, 1549318761 }, + { 13, 114969, 0, 1559292691 }, + { 14, 115257, 0, 1559292774 }, }; static const struct { diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp index bea24c74f..e956be9d2 100644 --- a/src/cryptonote_core/cryptonote_tx_utils.cpp +++ b/src/cryptonote_core/cryptonote_tx_utils.cpp @@ -674,15 +674,8 @@ namespace cryptonote bool get_block_longhash(const Blockchain *pbc, const block& b, crypto::hash& res, const uint64_t height, const int miners) { - // block 202612 bug workaround - if (height == 202612) - { - static const std::string longhash_202612 = "84f64766475d51837ac9efbef1926486e58563c95a19fef4aec3254f03000000"; - epee::string_tools::hex_to_pod(longhash_202612, res); - return true; - } blobdata bd = get_block_hashing_blob(b); - const int pow_variant = b.major_version >= 7 ? b.major_version - 6 : 0; + const int pow_variant = b.major_version >= 13 ? 6 : b.major_version >= 11 && b.major_version <= 12 ? 4 : 2; if (pow_variant >= 6) { uint64_t seed_height; if (rx_needhash(height, &seed_height)) {