Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 33 additions & 16 deletions .github/workflows/vdf-client-hw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13-intel, macos-13-arm64, windows-latest]
os: [ubuntu-latest, ubuntu-24.04-arm, macos-13-intel, macos-13-arm64, windows-latest]
config: [optimized=1, TSAN=1, ASAN=1]
exclude:
- os: windows-latest
Expand Down Expand Up @@ -70,12 +70,12 @@ jobs:
# Apply before build because make TSAN=1 runs ./compile_asm during build.
# See: https://github.com/google/sanitizers/issues/1716
- name: Adjust mmap_rnd_bits before Ubuntu TSAN build/test execution
if: matrix.os == 'ubuntu-latest' && matrix.config == 'TSAN=1'
if: startsWith(matrix.os, 'ubuntu') && matrix.config == 'TSAN=1'
run: |
sudo sysctl vm.mmap_rnd_bits=28

- name: Build on Ubuntu
if: matrix.os == 'ubuntu-latest'
if: startsWith(matrix.os, 'ubuntu')
run: |
# Keep mmap_rnd_bits workaround step above this build for TSAN=1:
# make TSAN=1 executes thread-sanitized ./compile_asm during build.
Expand Down Expand Up @@ -237,7 +237,7 @@ jobs:
}

- name: Run HW smoke test (Ubuntu/macOS)
if: matrix.os != 'windows-latest' && (matrix.config != 'TSAN=1' || matrix.os == 'ubuntu-latest')
if: matrix.os != 'windows-latest' && (matrix.config != 'TSAN=1' || startsWith(matrix.os, 'ubuntu'))
run: |
cd src
# CI runners do not have FT4222 hardware attached; only validate binaries exist.
Expand All @@ -249,7 +249,7 @@ jobs:
./emu_hw_vdf_client --list

- name: Run vdf tests (optimized smoke)
if: matrix.config == 'optimized=1' && matrix.os != 'windows-latest' && matrix.os != 'ubuntu-latest'
if: matrix.config == 'optimized=1' && matrix.os != 'windows-latest' && !startsWith(matrix.os, 'ubuntu')
run: |
cd src
echo "Running 1weso_test (fast smoke)"
Expand All @@ -258,7 +258,7 @@ jobs:
./2weso_test 1000

- name: Run vdf tests (optimized protected threshold path)
if: matrix.config == 'optimized=1' && matrix.os == 'ubuntu-latest'
if: matrix.config == 'optimized=1' && startsWith(matrix.os, 'ubuntu')
run: |
cd src
echo "Running 1weso_test (fast smoke)"
Expand All @@ -280,7 +280,7 @@ jobs:
# it prints to std::cout from multiple threads. Which is allowed by the
# standard
- name: Run prover test (Ubuntu/macOS)
if: matrix.os != 'windows-latest' && (matrix.config != 'TSAN=1' || matrix.os == 'ubuntu-latest')
if: matrix.os != 'windows-latest' && (matrix.config != 'TSAN=1' || startsWith(matrix.os, 'ubuntu'))
run: |
cd src
echo "Running prover_test"
Expand Down Expand Up @@ -364,8 +364,25 @@ jobs:
.\vdf_bench.exe square_asm 2000000
if ($LASTEXITCODE -ne 0) { throw "vdf_bench failed with exit code $LASTEXITCODE" }

- name: Upload binaries artifact (Ubuntu/macOS)
if: matrix.os != 'windows-latest' && matrix.config == 'optimized=1'
- name: Upload binaries artifact (Ubuntu)
if: startsWith(matrix.os, 'ubuntu') && matrix.config == 'optimized=1'
uses: actions/upload-artifact@v6
with:
name: binaries-${{ matrix.config }}-${{ matrix.os }}
path: |
src/vdf_client
src/vdf_bench
src/1weso_test
src/2weso_test
src/prover_test
src/emu_hw_test
src/hw_test
src/emu_hw_vdf_client
src/hw_vdf_client
${{ matrix.os == 'ubuntu-24.04-arm' && 'src/hw/libft4222/build-arm-v8/libft4222.so' || 'src/hw/libft4222/build-x86_64/libft4222.so' }}

- name: Upload binaries artifact (macOS)
if: startsWith(matrix.os, 'macos') && matrix.config == 'optimized=1'
uses: actions/upload-artifact@v6
with:
name: binaries-${{ matrix.config }}-${{ matrix.os }}
Expand All @@ -379,7 +396,6 @@ jobs:
src/hw_test
src/emu_hw_vdf_client
src/hw_vdf_client
src/hw/libft4222/build-x86_64/libft4222.so
src/hw/libft4222/*.dylib

- name: Upload binaries artifact (Windows)
Expand All @@ -402,11 +418,12 @@ jobs:
mpir_gc_x64/*.dll

- name: Assemble Ubuntu .deb (same runner as build)
if: matrix.os == 'ubuntu-latest' && matrix.config == 'optimized=1'
if: startsWith(matrix.os, 'ubuntu') && matrix.config == 'optimized=1'
env:
RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || '' }}
INSTALLER_VERSION: "${{ github.event_name == 'release' && github.event.release.tag_name || format('0.0.1-{0}', github.run_id) }}"
PLATFORM: "amd64"
PLATFORM: ${{ matrix.os == 'ubuntu-24.04-arm' && 'arm64' || 'amd64' }}
LIBFT4222_DIR: ${{ matrix.os == 'ubuntu-24.04-arm' && 'build-arm-v8' || 'build-x86_64' }}
run: |
pip install jinjanator
CLI_DEB_BASE="chiavdf_$INSTALLER_VERSION-1_$PLATFORM"
Expand All @@ -422,19 +439,19 @@ jobs:
cp src/hw_test dist/$CLI_DEB_BASE/usr/bin/
cp src/hw_vdf_client dist/$CLI_DEB_BASE/usr/bin/
cp src/emu_hw_vdf_client dist/$CLI_DEB_BASE/usr/bin/
cp src/hw/libft4222/build-x86_64/libft4222.so dist/$CLI_DEB_BASE/usr/lib/
cp "src/hw/libft4222/$LIBFT4222_DIR/libft4222.so" dist/$CLI_DEB_BASE/usr/lib/
echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="601c", MODE="0666"' > dist/$CLI_DEB_BASE/etc/udev/rules.d/99-chiavdf.rules
dpkg-deb --build --root-owner-group "dist/$CLI_DEB_BASE"

- name: Upload Ubuntu installer
if: matrix.os == 'ubuntu-latest' && matrix.config == 'optimized=1'
if: startsWith(matrix.os, 'ubuntu') && matrix.config == 'optimized=1'
uses: actions/upload-artifact@v6
with:
name: installer
name: installer-${{ matrix.os }}
path: dist/*.deb

- name: Upload release artifacts
if: matrix.os == 'ubuntu-latest' && matrix.config == 'optimized=1' && github.event_name == 'release'
if: startsWith(matrix.os, 'ubuntu') && matrix.config == 'optimized=1' && github.event_name == 'release'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ src/hw_vdf_client

# external library
/src/hw/libft4222
/src/libft4222/

# pyenv
.python-version
Expand Down
16 changes: 14 additions & 2 deletions scripts/get-libft4222.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,22 @@ install_linux() {
fetch_with_retry "$LINUX_URL" "$LINUX_ARCHIVE" tgz 3
tar -xzf "$LINUX_ARCHIVE" -C "$WORK_DIR"

local linux_arch
linux_arch="$(uname -m)"
local libft4222_dir
case "$linux_arch" in
x86_64) libft4222_dir="build-x86_64" ;;
aarch64|arm64) libft4222_dir="build-arm-v8" ;;
*)
echo "Unsupported Linux architecture for libft4222: $linux_arch" >&2
exit 1
;;
esac

rm -rf "$HW_DIR"
ln -s "$WORK_DIR" "$HW_DIR"
ln -sf "$WORK_DIR/build-x86_64/libft4222.so.1.4.4.170" \
"$WORK_DIR/build-x86_64/libft4222.so"
ln -sf "$WORK_DIR/$libft4222_dir/libft4222.so.1.4.4.170" \
"$WORK_DIR/$libft4222_dir/libft4222.so"
}

install_macos() {
Expand Down
12 changes: 11 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,18 @@ if(BUILD_HW_TOOLS)
)
set(HW_SOCKET_LIBS)
else()
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" HW_ARCH_LOWER)
if(HW_ARCH_LOWER STREQUAL "x86_64" OR HW_ARCH_LOWER STREQUAL "amd64")
set(HW_LIB_DIR "build-x86_64")
elseif(HW_ARCH_LOWER STREQUAL "aarch64" OR HW_ARCH_LOWER STREQUAL "arm64" OR HW_ARCH_LOWER MATCHES "^armv8")
set(HW_LIB_DIR "build-arm-v8")
else()
message(FATAL_ERROR
"Unsupported Linux architecture for FT4222 hardware tools: ${CMAKE_SYSTEM_PROCESSOR}. "
"Expected one of: x86_64, amd64, aarch64, arm64, armv8*.")
endif()
set(HW_LIBS
${CMAKE_CURRENT_SOURCE_DIR}/hw/libft4222/build-x86_64/libft4222.so
${CMAKE_CURRENT_SOURCE_DIR}/hw/libft4222/${HW_LIB_DIR}/libft4222.so
Comment thread
cursor[bot] marked this conversation as resolved.
)
set(HW_SOCKET_LIBS)
endif()
Expand Down
20 changes: 17 additions & 3 deletions src/Makefile.vdf-client
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
UNAME := $(shell uname)
ARCH := $(shell uname -m)
# Allow callers/CI to override ARCH, otherwise detect from host.
ARCH ?= $(shell uname -m)
ARCH_CANON := $(ARCH)
ifeq ($(ARCH_CANON),amd64)
ARCH_CANON := x86_64
else ifeq ($(ARCH_CANON),arm64)
ARCH_CANON := aarch64
endif
GIT_DESCRIBE := $(strip $(shell git describe --tags --always 2>/dev/null))
CHIAVDF_VERSION ?= $(if $(GIT_DESCRIBE),$(GIT_DESCRIBE),dev)

Expand Down Expand Up @@ -64,7 +71,7 @@ endif
.PHONY: all clean

# Only x86_64 builds use the x86 asm objects
ifeq ($(ARCH),x86_64)
ifeq ($(ARCH_CANON),x86_64)
ASM_OBJS = asm_compiled.o avx2_asm_compiled.o avx512_asm_compiled.o
else
ASM_OBJS =
Expand Down Expand Up @@ -108,7 +115,14 @@ HW_LIB = hw/libft4222/libft4222.dylib
HW_FTD2XX_LIB = hw/libft4222/libftd2xx.dylib
HW_LIBS = $(HW_LIB) $(HW_FTD2XX_LIB)
else
HW_LIB = hw/libft4222/build-x86_64/libft4222.so
ifeq ($(ARCH_CANON),x86_64)
HW_LIB_DIR = build-x86_64
else ifeq ($(ARCH_CANON),aarch64)
HW_LIB_DIR = build-arm-v8
else
$(error Unsupported Linux architecture for FT4222 hardware tools: $(ARCH). Expected one of: x86_64, aarch64/arm64, amd64)
endif
Comment thread
cursor[bot] marked this conversation as resolved.
HW_LIB = hw/libft4222/$(HW_LIB_DIR)/libft4222.so
HW_LIBS = $(HW_LIB)
endif
endif
Expand Down
Loading