Look into upgrading to the latest RandomX release #337

Closed
opened 6 months ago by duke · 8 comments
duke commented 6 months ago
Owner

https://github.com/tevador/RandomX/releases/tag/v1.2.1

It includes the fix for gcc13 that @jahway603 reported and some optimizations/bugfixes

https://github.com/tevador/RandomX/releases/tag/v1.2.1 It includes the fix for gcc13 that @jahway603 reported and some optimizations/bugfixes
Poster
Owner

This task involves copying the v1.2.1 source code into our source tree at src/RandomX , possibly deleting some stuff we don't store (such as large PDFs of audits/etc) and then verifying that randomx mining still works currently on a testchain and on dragonx mainnet

This task involves copying the v1.2.1 source code into our source tree at `src/RandomX` , possibly deleting some stuff we don't store (such as large PDFs of audits/etc) and then verifying that randomx mining still works currently on a testchain and on dragonx mainnet
Poster
Owner

@dan_s is this something you would be interested in working on? We could probably get this into the upcoming hushd release if someone other than me works on it

@dan_s is this something you would be interested in working on? We could probably get this into the upcoming hushd release if someone other than me works on it
Poster
Owner

Documenting how to update our in-tree version of RandomX for posterity. Assumes you have RandomX and hush3 git repos in ~/git . It would be nice to turn this into a script, maybe one day. We now have RandomX v1.2.1 on the dev branch, it now needs testing to make sure it is compatible with dragonx mainnet.

cd ~/git/RandomX
git pull
git checkout v1.2.1 # change this to whatever release tag you want
cd ~/git/hush3/src/RandomX
git checkout dev # or some topic branch of dev
# this command avoids copying .git, .github and audits/ directory
# it might need to be updated if they add more files we want to the root dir
cp -R ~/newgit/RandomX/{CMakeLists.txt,doc,src,LICENSE,README.md,randomx.sln,vcxproj,.gitignore} .

# now run git status . and you should see various changed files and some new files
# we need to add the new files, this command works for upgrading to 1.2.1 but you
# might need to tweak it for other versions
# TODO: this messes up src/configuration.h !
git add * src/* src/tests/*
git commit -m "Updating RandomX to v1.2.1"
git push
Documenting how to update our in-tree version of RandomX for posterity. Assumes you have RandomX and hush3 git repos in ~/git . It would be nice to turn this into a script, maybe one day. We now have RandomX v1.2.1 on the dev branch, it now needs testing to make sure it is compatible with dragonx mainnet. ``` cd ~/git/RandomX git pull git checkout v1.2.1 # change this to whatever release tag you want cd ~/git/hush3/src/RandomX git checkout dev # or some topic branch of dev # this command avoids copying .git, .github and audits/ directory # it might need to be updated if they add more files we want to the root dir cp -R ~/newgit/RandomX/{CMakeLists.txt,doc,src,LICENSE,README.md,randomx.sln,vcxproj,.gitignore} . # now run git status . and you should see various changed files and some new files # we need to add the new files, this command works for upgrading to 1.2.1 but you # might need to tweak it for other versions # TODO: this messes up src/configuration.h ! git add * src/* src/tests/* git commit -m "Updating RandomX to v1.2.1" git push ```
Poster
Owner

I got a compile error when running build.sh for the first time after updating the RandomX code :

Scanning dependencies of target randomx-benchmark
[ 82%] Building CXX object CMakeFiles/randomx-benchmark.dir/src/tests/benchmark.cpp.o
[ 85%] Building CXX object CMakeFiles/randomx-benchmark.dir/src/tests/affinity.cpp.o
[ 88%] Linking CXX executable randomx-benchmark
/usr/bin/ld: librandomx.a(jit_compiler_x86.cpp.o): in function `randomx::JitCompilerX86::JitCompilerX86()':
jit_compiler_x86.cpp:(.text+0x948): undefined reference to `allocMemoryPages'
/usr/bin/ld: librandomx.a(jit_compiler_x86.cpp.o): in function `randomx::JitCompilerX86::~JitCompilerX86()':
jit_compiler_x86.cpp:(.text+0x9b2): undefined reference to `freePagedMemory'
/usr/bin/ld: librandomx.a(jit_compiler_x86.cpp.o): in function `randomx::JitCompilerX86::enableAll()':
jit_compiler_x86.cpp:(.text+0x9de): undefined reference to `setPagesRWX'
/usr/bin/ld: librandomx.a(jit_compiler_x86.cpp.o): in function `randomx::JitCompilerX86::enableWriting()':
jit_compiler_x86.cpp:(.text+0x9fe): undefined reference to `setPagesRW'
/usr/bin/ld: librandomx.a(jit_compiler_x86.cpp.o): in function `randomx::JitCompilerX86::enableExecution()':
jit_compiler_x86.cpp:(.text+0xa1e): undefined reference to `setPagesRX'
/usr/bin/ld: librandomx.a(allocator.cpp.o): in function `randomx::LargePageAllocator::allocMemory(unsigned long)':
allocator.cpp:(.text+0x9): undefined reference to `allocLargePagesMemory'
/usr/bin/ld: librandomx.a(allocator.cpp.o): in function `randomx::LargePageAllocator::freeMemory(void*, unsigned long)':
allocator.cpp:(.text+0x25): undefined reference to `freePagedMemory'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/randomx-benchmark.dir/build.make:100: randomx-benchmark] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/randomx-benchmark.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

This happens with gcc 9.4.0

I got a compile error when running `build.sh` for the first time after updating the RandomX code : ``` Scanning dependencies of target randomx-benchmark [ 82%] Building CXX object CMakeFiles/randomx-benchmark.dir/src/tests/benchmark.cpp.o [ 85%] Building CXX object CMakeFiles/randomx-benchmark.dir/src/tests/affinity.cpp.o [ 88%] Linking CXX executable randomx-benchmark /usr/bin/ld: librandomx.a(jit_compiler_x86.cpp.o): in function `randomx::JitCompilerX86::JitCompilerX86()': jit_compiler_x86.cpp:(.text+0x948): undefined reference to `allocMemoryPages' /usr/bin/ld: librandomx.a(jit_compiler_x86.cpp.o): in function `randomx::JitCompilerX86::~JitCompilerX86()': jit_compiler_x86.cpp:(.text+0x9b2): undefined reference to `freePagedMemory' /usr/bin/ld: librandomx.a(jit_compiler_x86.cpp.o): in function `randomx::JitCompilerX86::enableAll()': jit_compiler_x86.cpp:(.text+0x9de): undefined reference to `setPagesRWX' /usr/bin/ld: librandomx.a(jit_compiler_x86.cpp.o): in function `randomx::JitCompilerX86::enableWriting()': jit_compiler_x86.cpp:(.text+0x9fe): undefined reference to `setPagesRW' /usr/bin/ld: librandomx.a(jit_compiler_x86.cpp.o): in function `randomx::JitCompilerX86::enableExecution()': jit_compiler_x86.cpp:(.text+0xa1e): undefined reference to `setPagesRX' /usr/bin/ld: librandomx.a(allocator.cpp.o): in function `randomx::LargePageAllocator::allocMemory(unsigned long)': allocator.cpp:(.text+0x9): undefined reference to `allocLargePagesMemory' /usr/bin/ld: librandomx.a(allocator.cpp.o): in function `randomx::LargePageAllocator::freeMemory(void*, unsigned long)': allocator.cpp:(.text+0x25): undefined reference to `freePagedMemory' collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/randomx-benchmark.dir/build.make:100: randomx-benchmark] Error 1 make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/randomx-benchmark.dir/all] Error 2 make: *** [Makefile:130: all] Error 2 ``` This happens with gcc 9.4.0
Poster
Owner

I think I am close to fixing this, it seems that src/virtual_memory.{cpp,hpp} were moved to src/virtual_memory.{c,h} to fix gcc13 issues and I forgot to update CMakeLists.txt

I think I am close to fixing this, it seems that src/virtual_memory.{cpp,hpp} were moved to src/virtual_memory.{c,h} to fix gcc13 issues and I forgot to update CMakeLists.txt
Poster
Owner

ok, dev branch is compiling again and I force pushed so that we have the updating of RandomX to v1.2.1 in a single commit. We now need to test this code

ok, dev branch is compiling again and I force pushed so that we have the updating of RandomX to v1.2.1 in a single commit. We now need to test this code
Poster
Owner

Just realized that I accidentally overwrote our custom RandomX config options in src/configuration.h, so I made a new commit to bring those back. To do that :

cd ~/git/hush3
# assumes the commit before this commit has what we want
git checkout HEAD~ -- src/configuration.h
git commit -m lulz
git push

Hopefully this issue documents the full process and makes it easier to do next time. This stuff should probably be in some developer docs somewhere and ideally automated with a script since it's easy to mess stuff up.

Just realized that I accidentally overwrote our custom RandomX config options in src/configuration.h, so I made a new commit to bring those back. To do that : ``` cd ~/git/hush3 # assumes the commit before this commit has what we want git checkout HEAD~ -- src/configuration.h git commit -m lulz git push ``` Hopefully this issue documents the full process and makes it easier to do next time. This stuff should probably be in some developer docs somewhere and ideally automated with a script since it's easy to mess stuff up.
duke added this to the 3.10.0 milestone 6 months ago
Poster
Owner

I added a link to this issue in our dev release process docs, so the process to upgrade RandomX in our repo doesn't get lost. There are reports of mining working correctly with this code on dragonx mainnet, closing.

I added a link to this issue in our dev release process docs, so the process to upgrade RandomX in our repo doesn't get lost. There are reports of mining working correctly with this code on dragonx mainnet, closing.
duke closed this issue 6 months ago
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.