Skip to content

Commit

Permalink
hashtree: bump, enable on mac, arm64 (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnetheduck authored May 25, 2024
1 parent af6afd1 commit f8b6e03
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
cpu: i386
- os: macos
cpu: amd64
- os: macos
cpu: arm64
- os: windows
cpu: amd64
#- os: windows
Expand All @@ -34,8 +36,15 @@ jobs:
shell: bash
- target:
os: macos
cpu: amd64
builder: macos-12
shell: bash
- target:
os: macos
cpu: arm64
# On macos-14, we get an M1 cpu
builder: macos-14
shell: bash
- target:
os: windows
builder: windows-2019
Expand Down Expand Up @@ -122,6 +131,8 @@ jobs:
run: |
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
PLATFORM=x64
elif [[ '${{ matrix.target.cpu }}' == 'arm64' ]]; then
PLATFORM=arm64
else
PLATFORM=x86
fi
Expand All @@ -148,7 +159,7 @@ jobs:
- name: Build Nim and Nimble
run: |
curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh
env MAKE="${MAKE_CMD} -j${ncpu}" ARCH_OVERRIDE=${PLATFORM} NIM_COMMIT=${{ matrix.branch }} \
env MAKE="${MAKE_CMD} -j${ncpu}" V=1 ARCH_OVERRIDE=${PLATFORM} NIM_COMMIT=${{ matrix.branch }} \
QUICK_AND_DIRTY_COMPILER=1 QUICK_AND_DIRTY_NIMBLE=1 CC=gcc \
bash build_nim.sh nim csources dist/nimble NimBinaries
echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH
Expand Down
11 changes: 6 additions & 5 deletions ssz_serialization/digest.nim
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import nimcrypto/[hash, sha2], stew/ptrops, ./types

const PREFER_BLST_SHA256* {.booldefine.} = true
# TODO https://github.com/prysmaticlabs/hashtree/issues/28
const PREFER_HASHTREE_SHA256* {.booldefine.} = not defined(arm64)
const PREFER_HASHTREE_SHA256* {.booldefine.} = true

when PREFER_BLST_SHA256:
import blscurve
Expand All @@ -38,10 +38,11 @@ else:
{.hint: "nimcrypto SHA256 backend enabled".}
type DigestCtx* = sha2.sha256

when PREFER_HASHTREE_SHA256 and
(defined(arm64) or defined(amd64)) and
((defined(gcc) and (defined(linux) or defined(windows))) or
(defined(clang) and defined(linux))):
when PREFER_HASHTREE_SHA256 and (defined(arm64) or defined(amd64)) and (
((defined(linux) or defined(windows)) and defined(gcc)) or
(defined(linux) and defined(clang)) or
(defined(macosx) and defined(clang) and defined(arm64))
):
{.hint: "Hashtree SHA256 backend enabled".}
const USE_HASHTREE_SHA256 = true

Expand Down

0 comments on commit f8b6e03

Please sign in to comment.