mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Merge branch 'testnet' into accelerator
This commit is contained in:
commit
5e0b190fc2
8 changed files with 248 additions and 20 deletions
8
.github/workflows/ton-x86-64-windows.yml
vendored
8
.github/workflows/ton-x86-64-windows.yml
vendored
|
@ -9,7 +9,7 @@ defaults:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: windows-2022
|
runs-on: windows-2019
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Get Current OS version
|
- name: Get Current OS version
|
||||||
|
@ -23,9 +23,9 @@ jobs:
|
||||||
|
|
||||||
- name: Build TON
|
- name: Build TON
|
||||||
run: |
|
run: |
|
||||||
copy assembly\native\build-windows-github.bat .
|
copy assembly\native\build-windows-github-2019.bat .
|
||||||
copy assembly\native\build-windows.bat .
|
copy assembly\native\build-windows-2019.bat .
|
||||||
build-windows-github.bat Enterprise
|
build-windows-github-2019.bat Enterprise
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@master
|
uses: actions/upload-artifact@master
|
||||||
|
|
|
@ -37,6 +37,7 @@ if (NOT DEFINED SODIUM_USE_STATIC_LIBS)
|
||||||
option(SODIUM_USE_STATIC_LIBS "enable to statically link against sodium" OFF)
|
option(SODIUM_USE_STATIC_LIBS "enable to statically link against sodium" OFF)
|
||||||
endif()
|
endif()
|
||||||
if(NOT (SODIUM_USE_STATIC_LIBS EQUAL SODIUM_USE_STATIC_LIBS_LAST))
|
if(NOT (SODIUM_USE_STATIC_LIBS EQUAL SODIUM_USE_STATIC_LIBS_LAST))
|
||||||
|
if (NOT SODIUM_LIBRARY_RELEASE)
|
||||||
unset(sodium_LIBRARY CACHE)
|
unset(sodium_LIBRARY CACHE)
|
||||||
unset(SODIUM_LIBRARY_DEBUG CACHE)
|
unset(SODIUM_LIBRARY_DEBUG CACHE)
|
||||||
unset(SODIUM_LIBRARY_RELEASE CACHE)
|
unset(SODIUM_LIBRARY_RELEASE CACHE)
|
||||||
|
@ -44,6 +45,7 @@ if(NOT (SODIUM_USE_STATIC_LIBS EQUAL SODIUM_USE_STATIC_LIBS_LAST))
|
||||||
unset(sodium_DLL_RELEASE CACHE)
|
unset(sodium_DLL_RELEASE CACHE)
|
||||||
set(SODIUM_USE_STATIC_LIBS_LAST ${SODIUM_USE_STATIC_LIBS} CACHE INTERNAL "internal change tracking variable")
|
set(SODIUM_USE_STATIC_LIBS_LAST ${SODIUM_USE_STATIC_LIBS} CACHE INTERNAL "internal change tracking variable")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
221
assembly/native/build-windows-2019.bat
Normal file
221
assembly/native/build-windows-2019.bat
Normal file
|
@ -0,0 +1,221 @@
|
||||||
|
REM execute this script inside elevated (Run as Administrator) console "x64 Native Tools Command Prompt for VS 2019"
|
||||||
|
|
||||||
|
echo off
|
||||||
|
|
||||||
|
echo Installing chocolatey windows package manager...
|
||||||
|
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
|
||||||
|
choco -?
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo Can't install chocolatey
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
|
||||||
|
choco feature enable -n allowEmptyChecksums
|
||||||
|
|
||||||
|
echo Installing pkgconfiglite...
|
||||||
|
choco install -y pkgconfiglite
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo Can't install pkgconfiglite
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
|
||||||
|
echo Installing ninja...
|
||||||
|
choco install -y ninja
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo Can't install ninja
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "zlib" (
|
||||||
|
git clone https://github.com/madler/zlib.git
|
||||||
|
cd zlib
|
||||||
|
git checkout v1.3.1
|
||||||
|
cd contrib\vstudio\vc14
|
||||||
|
msbuild zlibstat.vcxproj /p:Configuration=ReleaseWithoutAsm /p:platform=x64 -p:PlatformToolset=v142
|
||||||
|
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo Can't install zlib
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
cd ..\..\..\..
|
||||||
|
) else (
|
||||||
|
echo Using zlib...
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "lz4" (
|
||||||
|
git clone https://github.com/lz4/lz4.git
|
||||||
|
cd lz4
|
||||||
|
git checkout v1.9.4
|
||||||
|
cd build\VS2017\liblz4
|
||||||
|
msbuild liblz4.vcxproj /p:Configuration=Release /p:platform=x64 -p:PlatformToolset=v142
|
||||||
|
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo Can't install lz4
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
cd ..\..\..\..
|
||||||
|
) else (
|
||||||
|
echo Using lz4...
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "secp256k1" (
|
||||||
|
git clone https://github.com/bitcoin-core/secp256k1.git
|
||||||
|
cd secp256k1
|
||||||
|
git checkout v0.3.2
|
||||||
|
cmake -G "Visual Studio 16 2019" -A x64 -S . -B build -DSECP256K1_ENABLE_MODULE_RECOVERY=ON -DBUILD_SHARED_LIBS=OFF
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo Can't configure secp256k1
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
cmake --build build --config Release
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo Can't install secp256k1
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
cd ..
|
||||||
|
) else (
|
||||||
|
echo Using secp256k1...
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
curl --retry 5 --retry-delay 10 -Lo libsodium-1.0.18-stable-msvc.zip https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable-msvc.zip
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo Can't download libsodium
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
unzip libsodium-1.0.18-stable-msvc.zip
|
||||||
|
) else (
|
||||||
|
echo Using libsodium...
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "openssl-3.1.4" (
|
||||||
|
curl -Lo openssl-3.1.4.zip https://github.com/neodiX42/precompiled-openssl-win64/raw/main/openssl-3.1.4.zip
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo Can't download OpenSSL
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
unzip -q openssl-3.1.4.zip
|
||||||
|
) else (
|
||||||
|
echo Using openssl...
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "libmicrohttpd-0.9.77-w32-bin" (
|
||||||
|
curl -Lo libmicrohttpd-0.9.77-w32-bin.zip https://github.com/neodiX42/precompiled-openssl-win64/raw/main/libmicrohttpd-0.9.77-w32-bin.zip
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo Can't download libmicrohttpd
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
unzip -q libmicrohttpd-0.9.77-w32-bin.zip
|
||||||
|
) else (
|
||||||
|
echo Using libmicrohttpd...
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "readline-5.0-1-lib" (
|
||||||
|
curl -Lo readline-5.0-1-lib.zip https://github.com/neodiX42/precompiled-openssl-win64/raw/main/readline-5.0-1-lib.zip
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo Can't download readline
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
unzip -q -d readline-5.0-1-lib readline-5.0-1-lib.zip
|
||||||
|
) else (
|
||||||
|
echo Using readline...
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
set root=%cd%
|
||||||
|
echo %root%
|
||||||
|
set SODIUM_DIR=%root%\libsodium
|
||||||
|
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ^
|
||||||
|
-DPORTABLE=1 ^
|
||||||
|
-DSODIUM_USE_STATIC_LIBS=1 ^
|
||||||
|
-DSECP256K1_FOUND=1 ^
|
||||||
|
-DSECP256K1_INCLUDE_DIR=%root%\secp256k1\include ^
|
||||||
|
-DSECP256K1_LIBRARY=%root%\secp256k1\build\src\Release\libsecp256k1.lib ^
|
||||||
|
-DLZ4_FOUND=1 ^
|
||||||
|
-DLZ4_INCLUDE_DIRS=%root%\lz4\lib ^
|
||||||
|
-DLZ4_LIBRARIES=%root%\lz4\build\VS2017\liblz4\bin\x64_Release\liblz4_static.lib ^
|
||||||
|
-DMHD_FOUND=1 ^
|
||||||
|
-DMHD_LIBRARY=%root%\libmicrohttpd-0.9.77-w32-bin\x86_64\VS2019\Release-static\libmicrohttpd.lib ^
|
||||||
|
-DMHD_INCLUDE_DIR=%root%\libmicrohttpd-0.9.77-w32-bin\x86_64\VS2019\Release-static ^
|
||||||
|
-DZLIB_FOUND=1 ^
|
||||||
|
-DZLIB_INCLUDE_DIR=%root%\zlib ^
|
||||||
|
-DZLIB_LIBRARIES=%root%\zlib\contrib\vstudio\vc14\x64\ZlibStatReleaseWithoutAsm\zlibstat.lib ^
|
||||||
|
-DOPENSSL_FOUND=1 ^
|
||||||
|
-DOPENSSL_INCLUDE_DIR=%root%\openssl-3.1.4\x64\include ^
|
||||||
|
-DOPENSSL_CRYPTO_LIBRARY=%root%\openssl-3.1.4\x64\lib\libcrypto_static.lib ^
|
||||||
|
-DREADLINE_INCLUDE_DIR=%root%\readline-5.0-1-lib\include ^
|
||||||
|
-DREADLINE_LIBRARY=%root%\readline-5.0-1-lib\lib\readline.lib ^
|
||||||
|
-DCMAKE_CXX_FLAGS="/DTD_WINDOWS=1 /EHsc /bigobj" ..
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo Can't configure TON
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
|
||||||
|
IF "%1"=="-t" (
|
||||||
|
ninja storage-daemon storage-daemon-cli blockchain-explorer fift func tonlib tonlibjson ^
|
||||||
|
tonlib-cli validator-engine lite-client pow-miner validator-engine-console generate-random-id ^
|
||||||
|
json2tlo dht-server http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork emulator ^
|
||||||
|
test-ed25519 test-ed25519-crypto test-bigint test-vm test-fift test-cells test-smartcont test-net ^
|
||||||
|
test-tdactor test-tdutils test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain ^
|
||||||
|
test-fec test-tddb test-db test-validator-session-state
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo Can't compile TON
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
ninja storage-daemon storage-daemon-cli blockchain-explorer fift func tonlib tonlibjson ^
|
||||||
|
tonlib-cli validator-engine lite-client pow-miner validator-engine-console generate-random-id ^
|
||||||
|
json2tlo dht-server http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork emulator
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo Can't compile TON
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
copy validator-engine\validator-engine.exe test
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo validator-engine.exe does not exist
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
|
||||||
|
IF "%1"=="-t" (
|
||||||
|
echo Running tests...
|
||||||
|
REM ctest -C Release --output-on-failure -E "test-catchain|test-actors|test-validator-session-state"
|
||||||
|
ctest -C Release --output-on-failure -E "test-bigint" --timeout 1800
|
||||||
|
IF %errorlevel% NEQ 0 (
|
||||||
|
echo Some tests failed
|
||||||
|
exit /b %errorlevel%
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
echo Creating artifacts...
|
||||||
|
cd ..
|
||||||
|
mkdir artifacts
|
||||||
|
mkdir artifacts\smartcont
|
||||||
|
mkdir artifacts\lib
|
||||||
|
|
||||||
|
for %%I in (build\storage\storage-daemon\storage-daemon.exe ^
|
||||||
|
build\storage\storage-daemon\storage-daemon-cli.exe ^
|
||||||
|
build\blockchain-explorer\blockchain-explorer.exe ^
|
||||||
|
build\crypto\fift.exe ^
|
||||||
|
build\crypto\tlbc.exe ^
|
||||||
|
build\crypto\func.exe ^
|
||||||
|
build\crypto\create-state.exe ^
|
||||||
|
build\validator-engine-console\validator-engine-console.exe ^
|
||||||
|
build\tonlib\tonlib-cli.exe ^
|
||||||
|
build\tonlib\tonlibjson.dll ^
|
||||||
|
build\http\http-proxy.exe ^
|
||||||
|
build\rldp-http-proxy\rldp-http-proxy.exe ^
|
||||||
|
build\dht-server\dht-server.exe ^
|
||||||
|
build\lite-client\lite-client.exe ^
|
||||||
|
build\validator-engine\validator-engine.exe ^
|
||||||
|
build\utils\generate-random-id.exe ^
|
||||||
|
build\utils\json2tlo.exe ^
|
||||||
|
build\adnl\adnl-proxy.exe ^
|
||||||
|
build\emulator\emulator.dll) do (strip -g %%I & copy %%I artifacts\)
|
||||||
|
xcopy /e /k /h /i crypto\smartcont artifacts\smartcont
|
||||||
|
xcopy /e /k /h /i crypto\fift\lib artifacts\lib
|
2
assembly/native/build-windows-github-2019.bat
Normal file
2
assembly/native/build-windows-github-2019.bat
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\%1\VC\Auxiliary\Build\vcvars64.bat"
|
||||||
|
call build-windows-2019.bat -t
|
|
@ -38,22 +38,26 @@ cd ..
|
||||||
|
|
||||||
git clone https://github.com/madler/zlib.git
|
git clone https://github.com/madler/zlib.git
|
||||||
cd zlib
|
cd zlib
|
||||||
|
git checkout v1.3.1
|
||||||
ZLIB_DIR=`pwd`
|
ZLIB_DIR=`pwd`
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
git clone https://github.com/lz4/lz4.git
|
git clone https://github.com/lz4/lz4.git
|
||||||
cd lz4
|
cd lz4
|
||||||
|
git checkout v1.9.4
|
||||||
LZ4_DIR=`pwd`
|
LZ4_DIR=`pwd`
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
git clone https://github.com/bitcoin-core/secp256k1.git
|
git clone https://github.com/bitcoin-core/secp256k1.git
|
||||||
cd secp256k1
|
cd secp256k1
|
||||||
|
git checkout v0.3.2
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
SECP256K1_DIR=`pwd`
|
SECP256K1_DIR=`pwd`
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
git clone https://github.com/jedisct1/libsodium --branch stable
|
git clone https://github.com/jedisct1/libsodium
|
||||||
cd libsodium
|
cd libsodium
|
||||||
|
git checkout 1.0.18-RELEASE
|
||||||
SODIUM_DIR=`pwd`
|
SODIUM_DIR=`pwd`
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
|
|
@ -1837,7 +1837,6 @@ bool Transaction::prepare_action_phase(const ActionPhaseConfig& cfg) {
|
||||||
|
|
||||||
ap.tot_actions = n;
|
ap.tot_actions = n;
|
||||||
ap.spec_actions = ap.skipped_actions = 0;
|
ap.spec_actions = ap.skipped_actions = 0;
|
||||||
std::vector<Ref<vm::Cell>> non_skipped_action_list;
|
|
||||||
for (int i = n - 1; i >= 0; --i) {
|
for (int i = n - 1; i >= 0; --i) {
|
||||||
ap.result_arg = n - 1 - i;
|
ap.result_arg = n - 1 - i;
|
||||||
if (!block::gen::t_OutListNode.validate_ref(ap.action_list[i])) {
|
if (!block::gen::t_OutListNode.validate_ref(ap.action_list[i])) {
|
||||||
|
@ -1853,6 +1852,7 @@ bool Transaction::prepare_action_phase(const ActionPhaseConfig& cfg) {
|
||||||
int mode = (int)cs.fetch_ulong(8);
|
int mode = (int)cs.fetch_ulong(8);
|
||||||
if (mode & 2) {
|
if (mode & 2) {
|
||||||
ap.skipped_actions++;
|
ap.skipped_actions++;
|
||||||
|
ap.action_list[i] = {};
|
||||||
continue;
|
continue;
|
||||||
} else if ((mode & 16) && cfg.bounce_on_fail_enabled) {
|
} else if ((mode & 16) && cfg.bounce_on_fail_enabled) {
|
||||||
ap.bounce = true;
|
ap.bounce = true;
|
||||||
|
@ -1865,14 +1865,13 @@ bool Transaction::prepare_action_phase(const ActionPhaseConfig& cfg) {
|
||||||
LOG(DEBUG) << "invalid action " << ap.result_arg << " found while preprocessing action list: error code "
|
LOG(DEBUG) << "invalid action " << ap.result_arg << " found while preprocessing action list: error code "
|
||||||
<< ap.result_code;
|
<< ap.result_code;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
non_skipped_action_list.push_back(ap.action_list[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ap.action_list = std::move(non_skipped_action_list);
|
|
||||||
n -= ap.skipped_actions;
|
|
||||||
ap.valid = true;
|
ap.valid = true;
|
||||||
for (int i = n - 1; i >= 0; --i) {
|
for (int i = n - 1; i >= 0; --i) {
|
||||||
|
if(ap.action_list[i].is_null()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ap.result_arg = n - 1 - i;
|
ap.result_arg = n - 1 - i;
|
||||||
vm::CellSlice cs = load_cell_slice(ap.action_list[i]);
|
vm::CellSlice cs = load_cell_slice(ap.action_list[i]);
|
||||||
CHECK(cs.fetch_ref().not_null());
|
CHECK(cs.fetch_ref().not_null());
|
||||||
|
@ -1910,7 +1909,7 @@ bool Transaction::prepare_action_phase(const ActionPhaseConfig& cfg) {
|
||||||
ap.no_funds = true;
|
ap.no_funds = true;
|
||||||
}
|
}
|
||||||
LOG(DEBUG) << "invalid action " << ap.result_arg << " in action list: error code " << ap.result_code;
|
LOG(DEBUG) << "invalid action " << ap.result_arg << " in action list: error code " << ap.result_code;
|
||||||
// This is reuqired here because changes to libraries are applied even if actipn phase fails
|
// This is required here because changes to libraries are applied even if actipn phase fails
|
||||||
enforce_state_limits();
|
enforce_state_limits();
|
||||||
if (cfg.action_fine_enabled) {
|
if (cfg.action_fine_enabled) {
|
||||||
ap.action_fine = std::min(ap.action_fine, balance.grams);
|
ap.action_fine = std::min(ap.action_fine, balance.grams);
|
||||||
|
|
|
@ -90,7 +90,7 @@ class ValidatorSessionImpl : public ValidatorSession {
|
||||||
td::actor::ActorOwn<catchain::CatChain> catchain_;
|
td::actor::ActorOwn<catchain::CatChain> catchain_;
|
||||||
std::unique_ptr<ValidatorSessionDescription> description_;
|
std::unique_ptr<ValidatorSessionDescription> description_;
|
||||||
|
|
||||||
double catchain_max_block_delay_ = 0.5;
|
double catchain_max_block_delay_ = 0.4;
|
||||||
|
|
||||||
void on_new_round(td::uint32 round);
|
void on_new_round(td::uint32 round);
|
||||||
void on_catchain_started();
|
void on_catchain_started();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue