rm Miracl and remaining i386 (32-bit) build support (#2250)
This commit is contained in:
parent
0f430c70fd
commit
828fd63348
|
@ -36,9 +36,6 @@ jobs:
|
||||||
- os: linux
|
- os: linux
|
||||||
cpu: amd64
|
cpu: amd64
|
||||||
evmc: evmc
|
evmc: evmc
|
||||||
#- os: linux
|
|
||||||
# cpu: i386
|
|
||||||
# evmc: evmc
|
|
||||||
- os: macos
|
- os: macos
|
||||||
cpu: amd64
|
cpu: amd64
|
||||||
evmc: evmc
|
evmc: evmc
|
||||||
|
@ -48,9 +45,6 @@ jobs:
|
||||||
- os: linux
|
- os: linux
|
||||||
cpu: amd64
|
cpu: amd64
|
||||||
evmc: nimvm
|
evmc: nimvm
|
||||||
#- os: linux
|
|
||||||
# cpu: i386
|
|
||||||
# evmc: nimvm
|
|
||||||
- os: windows
|
- os: windows
|
||||||
cpu: amd64
|
cpu: amd64
|
||||||
evmc: nimvm
|
evmc: nimvm
|
||||||
|
@ -93,12 +87,6 @@ jobs:
|
||||||
echo "GOARCH=${GOARCH}" >> $GITHUB_ENV
|
echo "GOARCH=${GOARCH}" >> $GITHUB_ENV
|
||||||
echo "USE_MIRACL=${USE_MIRACL}" >> $GITHUB_ENV
|
echo "USE_MIRACL=${USE_MIRACL}" >> $GITHUB_ENV
|
||||||
|
|
||||||
# libminiupnp / natpmp
|
|
||||||
if [[ '${{ runner.os }}' == 'Linux' && '${{ matrix.target.cpu }}' == 'i386' ]]; then
|
|
||||||
export CFLAGS="${CFLAGS} -m32 -mno-adx"
|
|
||||||
echo "CFLAGS=${CFLAGS}" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
ncpu=''
|
ncpu=''
|
||||||
case '${{ runner.os }}' in
|
case '${{ runner.os }}' in
|
||||||
'Linux')
|
'Linux')
|
||||||
|
@ -120,26 +108,6 @@ jobs:
|
||||||
echo "ENABLE_EVMC=0" >> $GITHUB_ENV
|
echo "ENABLE_EVMC=0" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Install build dependencies (Linux i386)
|
|
||||||
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
|
|
||||||
run: |
|
|
||||||
sudo dpkg --add-architecture i386
|
|
||||||
sudo apt-fast update -qq
|
|
||||||
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
|
|
||||||
--no-install-recommends -yq gcc-multilib g++-multilib \
|
|
||||||
libz-dev:i386 libbz2-dev:i386 libssl-dev:i386 libpcre3-dev:i386
|
|
||||||
mkdir -p external/bin
|
|
||||||
cat << EOF > external/bin/gcc
|
|
||||||
#!/bin/bash
|
|
||||||
exec $(which gcc) -m32 "\$@"
|
|
||||||
EOF
|
|
||||||
cat << EOF > external/bin/g++
|
|
||||||
#!/bin/bash
|
|
||||||
exec $(which g++) -m32 "\$@"
|
|
||||||
EOF
|
|
||||||
chmod 755 external/bin/gcc external/bin/g++
|
|
||||||
echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH
|
|
||||||
|
|
||||||
- name: Install build dependencies (Macos)
|
- name: Install build dependencies (Macos)
|
||||||
# Some home brew modules were reported missing
|
# Some home brew modules were reported missing
|
||||||
if: runner.os == 'Macos'
|
if: runner.os == 'Macos'
|
||||||
|
@ -155,13 +123,6 @@ jobs:
|
||||||
path: rocks-db-cache-${{ matrix.target.cpu }}
|
path: rocks-db-cache-${{ matrix.target.cpu }}
|
||||||
key: 'rocksdb-v2-${{ matrix.target.os }}-${{ matrix.target.cpu }}'
|
key: 'rocksdb-v2-${{ matrix.target.os }}-${{ matrix.target.cpu }}'
|
||||||
|
|
||||||
- name: Build and install rocksdb (Linux i386)
|
|
||||||
# no librocksdb-dev:i386
|
|
||||||
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
|
|
||||||
run: |
|
|
||||||
curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_rocksdb.sh
|
|
||||||
bash build_rocksdb.sh rocks-db-cache-${{ matrix.target.cpu }}
|
|
||||||
|
|
||||||
- name: Install rocksdb (Linux amd64)
|
- name: Install rocksdb (Linux amd64)
|
||||||
# mysterious illegal instruction error if we build our own librocksdb
|
# mysterious illegal instruction error if we build our own librocksdb
|
||||||
if: runner.os == 'Linux' && matrix.target.cpu == 'amd64'
|
if: runner.os == 'Linux' && matrix.target.cpu == 'amd64'
|
||||||
|
@ -282,17 +243,12 @@ jobs:
|
||||||
env CC=gcc make ${DEFAULT_MAKE_FLAGS}
|
env CC=gcc make ${DEFAULT_MAKE_FLAGS}
|
||||||
build/nimbus --help
|
build/nimbus --help
|
||||||
# CC, GOARCH, and CGO_ENABLED are needed to select correct compiler 32/64 bit
|
# CC, GOARCH, and CGO_ENABLED are needed to select correct compiler 32/64 bit
|
||||||
if [[ '${{ matrix.target.cpu }}' == 'i386' ]]; then
|
|
||||||
# hide CI failures
|
|
||||||
env CC=gcc GOARCH=${GOARCH} CXX=g++ CGO_ENABLED=1 make ${DEFAULT_MAKE_FLAGS} test || true
|
|
||||||
else
|
|
||||||
# pushd vendor/nimbus-eth2
|
# pushd vendor/nimbus-eth2
|
||||||
# env NIMBUSEL_BINARY=../../build/nimbus NIMBUSEL_GENESIS=scripts/nimbusel_genesis.json \
|
# env NIMBUSEL_BINARY=../../build/nimbus NIMBUSEL_GENESIS=scripts/nimbusel_genesis.json \
|
||||||
# ./scripts/launch_local_testnet.sh --nodes=3 --stop-at-epoch=7 \
|
# ./scripts/launch_local_testnet.sh --nodes=3 --stop-at-epoch=7 \
|
||||||
# --disable-htop --reuse-binaries --run-nimbus-el --dl-eth2 --verbose --kill-old-processes
|
# --disable-htop --reuse-binaries --run-nimbus-el --dl-eth2 --verbose --kill-old-processes
|
||||||
# popd
|
# popd
|
||||||
env CC=gcc GOARCH=${GOARCH} CXX=g++ CGO_ENABLED=1 make ${DEFAULT_MAKE_FLAGS} test
|
env CC=gcc GOARCH=${GOARCH} CXX=g++ CGO_ENABLED=1 make ${DEFAULT_MAKE_FLAGS} test
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Run nimbus-eth1 tests (Macos)
|
- name: Run nimbus-eth1 tests (Macos)
|
||||||
if: runner.os == 'Macos'
|
if: runner.os == 'Macos'
|
||||||
|
|
7
Makefile
7
Makefile
|
@ -158,9 +158,6 @@ all: | $(TOOLS) nimbus
|
||||||
# must be included after the default target
|
# must be included after the default target
|
||||||
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk
|
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk
|
||||||
|
|
||||||
# default: use blst
|
|
||||||
USE_MIRACL := 0
|
|
||||||
|
|
||||||
# default: use nim native evm
|
# default: use nim native evm
|
||||||
ENABLE_EVMC := 0
|
ENABLE_EVMC := 0
|
||||||
|
|
||||||
|
@ -182,10 +179,6 @@ ifneq ($(USE_LIBBACKTRACE), 0)
|
||||||
deps: | libbacktrace
|
deps: | libbacktrace
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(USE_MIRACL), 0)
|
|
||||||
NIM_PARAMS += -d:BLS_FORCE_BACKEND=miracl
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(ENABLE_EVMC), 0)
|
ifneq ($(ENABLE_EVMC), 0)
|
||||||
NIM_PARAMS += -d:evmc_enabled
|
NIM_PARAMS += -d:evmc_enabled
|
||||||
T8N_PARAMS := -d:chronicles_enabled=off
|
T8N_PARAMS := -d:chronicles_enabled=off
|
||||||
|
|
|
@ -152,11 +152,6 @@ switch("warning", "ObservableStores:off")
|
||||||
# Too many false positives for "Warning: method has lock level <unknown>, but another method has 0 [LockLevel]"
|
# Too many false positives for "Warning: method has lock level <unknown>, but another method has 0 [LockLevel]"
|
||||||
switch("warning", "LockLevel:off")
|
switch("warning", "LockLevel:off")
|
||||||
|
|
||||||
if defined(windows) and defined(i386):
|
|
||||||
# avoid undefined reference to 'sqrx_mont_384x' when compiling in 32 bit mode
|
|
||||||
# without actually using __BLST_PORTABLE__ or __BLST_NO_ASM__
|
|
||||||
switch("define", "BLS_FORCE_BACKEND:miracl")
|
|
||||||
|
|
||||||
# nim-kzg shipping their own blst, nimbus-eth1 too.
|
# nim-kzg shipping their own blst, nimbus-eth1 too.
|
||||||
# disable nim-kzg's blst
|
# disable nim-kzg's blst
|
||||||
switch("define", "kzgExternalBlst")
|
switch("define", "kzgExternalBlst")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Nimbus
|
# Nimbus
|
||||||
# Copyright (c) 2020-2023 Status Research & Development GmbH
|
# Copyright (c) 2020-2024 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||||
|
@ -10,67 +10,6 @@
|
||||||
|
|
||||||
import blscurve/bls_backend, stint
|
import blscurve/bls_backend, stint
|
||||||
|
|
||||||
when BLS_BACKEND == Miracl:
|
|
||||||
import blscurve/miracl/[common, milagro, hash_to_curve, miracl_min_pubkey_sig_core]
|
|
||||||
import map_to_curve_g1
|
|
||||||
export common
|
|
||||||
export miracl_min_pubkey_sig_core.subgroupCheck
|
|
||||||
|
|
||||||
type
|
|
||||||
BLS_G1* = ECP_BLS12381
|
|
||||||
BLS_G2* = ECP2_BLS12381
|
|
||||||
BLS_FP* = BIG_384
|
|
||||||
BLS_FP2* = FP2_BLS12381
|
|
||||||
BLS_SCALAR* = BIG_384
|
|
||||||
BLS_FE* = FP_BLS12381
|
|
||||||
BLS_FE2* = FP2_BLS12381
|
|
||||||
BLS_ACC* = FP12_BLS12381
|
|
||||||
BLS_G1P* = BLS_G1
|
|
||||||
BLS_G2P* = BLS_G2
|
|
||||||
|
|
||||||
func pack(g: var BLS_G1, x, y: BLS_FP): bool {.inline.} =
|
|
||||||
discard ECP_BLS12381_set(g.addr, x, y)
|
|
||||||
let xx = x.nres
|
|
||||||
let yy = y.nres
|
|
||||||
isOnCurve(xx, yy)
|
|
||||||
|
|
||||||
func unpack(g: BLS_G1, x, y: var BLS_FP): bool {.inline.} =
|
|
||||||
discard g.get(x, y)
|
|
||||||
true
|
|
||||||
|
|
||||||
func pack(g: var BLS_G2, x0, x1, y0, y1: BLS_FP): bool =
|
|
||||||
var x, y: BLS_FP2
|
|
||||||
x.fromBigs(x0, x1)
|
|
||||||
y.fromBigs(y0, y1)
|
|
||||||
discard ECP2_BLS12381_set(g.addr, x.addr, y.addr)
|
|
||||||
isOnCurve(x, y)
|
|
||||||
|
|
||||||
func unpack(g: BLS_G2, x0, x1, y0, y1: var BLS_FP): bool =
|
|
||||||
var x, y: BLS_FP2
|
|
||||||
result = g.get(x, y) <= 0.cint
|
|
||||||
FP_BLS12381_redc(x0, addr x.a)
|
|
||||||
FP_BLS12381_redc(x1, addr x.b)
|
|
||||||
FP_BLS12381_redc(y0, addr y.a)
|
|
||||||
FP_BLS12381_redc(y1, addr y.b)
|
|
||||||
|
|
||||||
func mapFPToG1*(fp: BLS_FE): BLS_G1 {.inline.} =
|
|
||||||
mapToCurveG1(fp)
|
|
||||||
|
|
||||||
func mapFPToG2*(fp: BLS_FE2): BLS_G2 {.inline.} =
|
|
||||||
result = mapToCurveG2(fp)
|
|
||||||
result.clearCofactor()
|
|
||||||
|
|
||||||
func millerLoop*(g1: BLS_G1, g2: BLS_G2): BLS_ACC {.inline.} =
|
|
||||||
PAIR_BLS12381_ate(result.addr, g2.unsafeAddr, g1.unsafeAddr)
|
|
||||||
|
|
||||||
proc mul*(a: var BLS_ACC, b: BLS_ACC) {.inline.} =
|
|
||||||
FP12_BLS12381_mul(a.addr, b.unsafeAddr)
|
|
||||||
|
|
||||||
func check*(x: BLS_ACC): bool {.inline.} =
|
|
||||||
PAIR_BLS12381_fexp(x.unsafeAddr)
|
|
||||||
FP12_BLS12381_isunity(x.unsafeAddr).int == 1
|
|
||||||
|
|
||||||
else:
|
|
||||||
import blscurve/blst/[blst_lowlevel]
|
import blscurve/blst/[blst_lowlevel]
|
||||||
|
|
||||||
type
|
type
|
||||||
|
@ -207,24 +146,6 @@ func decodeFieldElement*(res: var BLS_FP, input: openArray[byte]): bool =
|
||||||
|
|
||||||
res.fromBytes input.toOpenArray(16, 63)
|
res.fromBytes input.toOpenArray(16, 63)
|
||||||
|
|
||||||
when BLS_BACKEND == Miracl:
|
|
||||||
proc decodeFE*(res: var BLS_FE, input: openArray[byte]): bool =
|
|
||||||
var big: BLS_FP
|
|
||||||
if not big.decodeFieldElement(input):
|
|
||||||
return false
|
|
||||||
res = big.nres()
|
|
||||||
# fieldModulus > big
|
|
||||||
BIG_384_comp(FIELD_Modulus, big).int == 1
|
|
||||||
|
|
||||||
proc decodeFE*(res: var BLS_FE2, input: openArray[byte]): bool =
|
|
||||||
if input.len != 128:
|
|
||||||
return false
|
|
||||||
|
|
||||||
if res.a.decodeFE(input.toOpenArray(0, 63)) and
|
|
||||||
res.b.decodeFE(input.toOpenArray(64, 127)):
|
|
||||||
result = true
|
|
||||||
|
|
||||||
else:
|
|
||||||
func decodeFE*(res: var BLS_FE, input: openArray[byte]): bool =
|
func decodeFE*(res: var BLS_FE, input: openArray[byte]): bool =
|
||||||
const
|
const
|
||||||
fieldModulus = StUint[512].fromHex "0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab"
|
fieldModulus = StUint[512].fromHex "0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab"
|
||||||
|
|
Loading…
Reference in New Issue