mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
TVM instructions: SECP256K1_XONLY_PUBKEY_TWEAK_ADD, SETCONTCTRMANY(X) (#1404)
* TVM instructions: SECP256K1_XONLY_PUBKEY_TWEAK_ADD, SETCONTCTRMANY(X) * Add tests for xonly_pubkey_tweak_add * added secp256k1 as submodule, since we need extrakeys feature of secp256k1 * cleanup * add ton_crypto_core secp256k1 dependency * adjust Dockerfile, android and wasm builds * adjust nix build * test windows build with SECP256K1_ENABLE_MODULE_EXTRAKEYS * test windows build with SECP256K1_ENABLE_MODULE_EXTRAKEYS * adjust android build * adjust emscripten build * adjust emscripten build * try macos-13 * emscripten build adjustments * windows build adjustments * final corrections --------- Co-authored-by: neodix <neodix@ton.org>
This commit is contained in:
parent
954a96a077
commit
25b4c6794a
56 changed files with 2112 additions and 502 deletions
|
@ -2,7 +2,7 @@
|
|||
# sudo apt update
|
||||
# sudo apt install -y build-essential git make cmake ninja-build clang libgflags-dev zlib1g-dev libssl-dev \
|
||||
# libreadline-dev libmicrohttpd-dev pkg-config libgsl-dev python3 python3-dev python3-pip \
|
||||
# nodejs libsecp256k1-dev libsodium-dev automake libtool
|
||||
# nodejs libsodium-dev automake libtool libjemalloc-dev
|
||||
|
||||
# wget https://apt.llvm.org/llvm.sh
|
||||
# chmod +x llvm.sh
|
||||
|
@ -26,13 +26,14 @@ export CCACHE_DISABLE=1
|
|||
|
||||
echo `pwd`
|
||||
if [ "$scratch_new" = true ]; then
|
||||
echo Compiling openssl zlib lz4 emsdk secp256k1 libsodium emsdk ton
|
||||
rm -rf openssl zlib lz4 emsdk secp256k1 libsodium build
|
||||
echo Compiling openssl zlib lz4 emsdk libsodium emsdk ton
|
||||
rm -rf openssl zlib lz4 emsdk libsodium build openssl_em
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d "openssl" ]; then
|
||||
git clone https://github.com/openssl/openssl.git
|
||||
cp -r openssl openssl_em
|
||||
cd openssl
|
||||
git checkout openssl-3.1.4
|
||||
./config
|
||||
|
@ -47,21 +48,20 @@ fi
|
|||
if [ ! -d "build" ]; then
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -GNinja -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_CXX_STANDARD=17 \
|
||||
-DOPENSSL_FOUND=1 \
|
||||
cmake -GNinja -DTON_USE_JEMALLOC=ON .. \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DOPENSSL_ROOT_DIR=$OPENSSL_DIR \
|
||||
-DOPENSSL_INCLUDE_DIR=$OPENSSL_DIR/include \
|
||||
-DOPENSSL_CRYPTO_LIBRARY=$OPENSSL_DIR/libcrypto.so \
|
||||
-DTON_USE_ABSEIL=OFF ..
|
||||
-DOPENSSL_CRYPTO_LIBRARY=$OPENSSL_DIR/libcrypto.so
|
||||
|
||||
test $? -eq 0 || { echo "Can't configure TON build"; exit 1; }
|
||||
ninja fift smc-envelope
|
||||
test $? -eq 0 || { echo "Can't compile fift "; exit 1; }
|
||||
rm -rf *
|
||||
rm -rf * .ninja* CMakeCache.txt
|
||||
cd ..
|
||||
else
|
||||
echo cleaning build...
|
||||
rm -rf build/*
|
||||
rm -rf build/* build/.ninja* build/CMakeCache.txt
|
||||
fi
|
||||
|
||||
if [ ! -d "emsdk" ]; then
|
||||
|
@ -71,8 +71,8 @@ echo
|
|||
fi
|
||||
|
||||
cd emsdk
|
||||
./emsdk install 3.1.19
|
||||
./emsdk activate 3.1.19
|
||||
./emsdk install 3.1.40
|
||||
./emsdk activate 3.1.40
|
||||
EMSDK_DIR=`pwd`
|
||||
|
||||
. $EMSDK_DIR/emsdk_env.sh
|
||||
|
@ -82,9 +82,8 @@ export CCACHE_DISABLE=1
|
|||
|
||||
cd ..
|
||||
|
||||
if [ ! -f "openssl/openssl_em" ]; then
|
||||
cd openssl
|
||||
make clean
|
||||
if [ ! -f "openssl_em/openssl_em" ]; then
|
||||
cd openssl_em
|
||||
emconfigure ./Configure linux-generic32 no-shared no-dso no-engine no-unit-test no-tests no-fuzz-afl no-fuzz-libfuzzer
|
||||
sed -i 's/CROSS_COMPILE=.*/CROSS_COMPILE=/g' Makefile
|
||||
sed -i 's/-ldl//g' Makefile
|
||||
|
@ -92,10 +91,12 @@ if [ ! -f "openssl/openssl_em" ]; then
|
|||
emmake make depend
|
||||
emmake make -j16
|
||||
test $? -eq 0 || { echo "Can't compile OpenSSL with emmake "; exit 1; }
|
||||
OPENSSL_DIR=`pwd`
|
||||
touch openssl_em
|
||||
cd ..
|
||||
else
|
||||
echo Using compiled openssl with emscripten
|
||||
OPENSSL_DIR=`pwd`/openssl_em
|
||||
echo Using compiled with empscripten openssl at $OPENSSL_DIR
|
||||
fi
|
||||
|
||||
if [ ! -d "zlib" ]; then
|
||||
|
@ -125,21 +126,6 @@ else
|
|||
echo Using compiled lz4 with emscripten at $LZ4_DIR
|
||||
fi
|
||||
|
||||
if [ ! -d "secp256k1" ]; then
|
||||
git clone https://github.com/bitcoin-core/secp256k1.git
|
||||
cd secp256k1
|
||||
git checkout v0.3.2
|
||||
./autogen.sh
|
||||
SECP256K1_DIR=`pwd`
|
||||
emconfigure ./configure --enable-module-recovery
|
||||
emmake make -j16
|
||||
test $? -eq 0 || { echo "Can't compile secp256k1 with emmake "; exit 1; }
|
||||
cd ..
|
||||
else
|
||||
SECP256K1_DIR=`pwd`/secp256k1
|
||||
echo Using compiled secp256k1 with emscripten at $SECP256K1_DIR
|
||||
fi
|
||||
|
||||
if [ ! -d "libsodium" ]; then
|
||||
git clone https://github.com/jedisct1/libsodium
|
||||
cd libsodium
|
||||
|
@ -168,9 +154,9 @@ emcmake cmake -DUSE_EMSCRIPTEN=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAK
|
|||
-DOPENSSL_CRYPTO_LIBRARY=$OPENSSL_DIR/libcrypto.a \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$EMSDK_DIR/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \
|
||||
-DCMAKE_CXX_FLAGS="-sUSE_ZLIB=1" \
|
||||
-DSECP256K1_INCLUDE_DIR=$SECP256K1_DIR/include \
|
||||
-DSECP256K1_LIBRARY=$SECP256K1_DIR/.libs/libsecp256k1.a \
|
||||
-DSODIUM_FOUND=1 \
|
||||
-DSODIUM_INCLUDE_DIR=$SODIUM_DIR/src/libsodium/include \
|
||||
-DSODIUM_USE_STATIC_LIBS=1 \
|
||||
-DSODIUM_LIBRARY_RELEASE=$SODIUM_DIR/src/libsodium/.libs/libsodium.a \
|
||||
..
|
||||
|
||||
|
@ -194,5 +180,3 @@ if [ "$with_artifacts" = true ]; then
|
|||
cp -R crypto/smartcont artifacts
|
||||
cp -R crypto/fift/lib artifacts
|
||||
fi
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue