Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge developer branch #701

Merged
merged 22 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fd4c512
Move JettonBridge config num for BNB, Polygon
EmelyanenkoK Apr 17, 2023
8d919a5
add missing VM opcode definition (#670)
ilyar Apr 19, 2023
8b0d6a2
Add WASM FunC autotests (#673)
EmelyanenkoK Apr 19, 2023
7ee7077
Add timeout for out_msg_queue_cleanup (#679)
EmelyanenkoK Apr 26, 2023
d067e6c
Make stricter cleanup timelimit
EmelyanenkoK Apr 26, 2023
1d9e5d3
Merge pull request #683 from ton-blockchain/master
EmelyanenkoK Apr 27, 2023
aab1fe0
Use BUILD_SHARED_LIBS to decide whether to build libemulator.so (#671)
aleksej-paschenko Apr 27, 2023
5606418
FunC: Prohibit unifying tensors and "forall" vars (#684)
EmelyanenkoK Apr 27, 2023
dd8658c
Comment out excessive checks of outbound messages queue
EmelyanenkoK Apr 27, 2023
8bc20ed
Add archive manager index (#685)
EmelyanenkoK Apr 28, 2023
444dda8
Revert too strictening of queue_cleanup_timeout
EmelyanenkoK Apr 28, 2023
87d4f4b
Fix saving list of packages in archive manager
SpyCheese May 2, 2023
24ed85b
Merge pull request #690 from SpyCheese/patch-archive-manager
EmelyanenkoK May 2, 2023
a78adf3
Increase limit for t_Block.validate, simplify validating StateInit (#…
EmelyanenkoK May 3, 2023
1696ebf
Account for unprocessed messages in estimate_block_size; check consen…
EmelyanenkoK May 4, 2023
f8b585d
Fix missing git revision when built with Nix. (#680)
neodix42 May 4, 2023
1aadc80
More portable (#681)
neodix42 May 4, 2023
7878578
Add day to the git tag name (#652)
neodix42 May 5, 2023
5abfe23
Catchain improvements (#698)
SpyCheese May 10, 2023
583178c
FunC: enable asserts and fix try/catch stack corruption (#699)
EmelyanenkoK May 15, 2023
dad980e
Fix STSLICECONST, bump Asm.fif version to 0.4.4 (#700)
SpyCheese May 15, 2023
d5cd548
Add 2023.05 changelog
EmelyanenkoK May 16, 2023
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
181 changes: 95 additions & 86 deletions .github/workflows/create-release.yml

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion .github/workflows/ubuntu-22.04-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,19 @@ jobs:
export CC=$(which clang)
export CXX=$(which clang++)
export CCACHE_DISABLE=1

git clone https://github.com/openssl/openssl openssl_1_1_1
cd openssl_1_1_1
git checkout OpenSSL_1_1_1-stable
./config
make build_libs -j4

cd ..
rootPath=`pwd`
mkdir build
cd build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPORTABLE=1 -DTON_ARCH= -DCMAKE_CXX_FLAGS="-mavx2" ..

cmake -GNinja -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=$rootPath/openssl_1_1_1/include -DOPENSSL_CRYPTO_LIBRARY=$rootPath/openssl_1_1_1/libcrypto.a -DCMAKE_BUILD_TYPE=Release -DPORTABLE=1 -DTON_ARCH= -DCMAKE_CXX_FLAGS="-mavx2" ..
ninja storage-daemon storage-daemon-cli 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

- name: Find & copy binaries
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/ubuntu-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,20 @@ jobs:
export CC=$(which clang)
export CXX=$(which clang++)
export CCACHE_DISABLE=1

mkdir build-${{ matrix.os }}
cd build-${{ matrix.os }}
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPORTABLE=1 -DTON_ARCH= -DCMAKE_CXX_FLAGS="-mavx2" ..

git clone https://github.com/openssl/openssl openssl_1_1_1
cd openssl_1_1_1
git checkout OpenSSL_1_1_1-stable
./config
make build_libs -j4

cd ..
buildPath=`pwd`

cmake -GNinja -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=$buildPath/openssl_1_1_1/include -DOPENSSL_CRYPTO_LIBRARY=$buildPath/openssl_1_1_1/libcrypto.a -DCMAKE_BUILD_TYPE=Release -DPORTABLE=1 -DTON_ARCH= -DCMAKE_CXX_FLAGS="-mavx2" ..
ninja storage-daemon storage-daemon-cli 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

- name: Find & copy binaries
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/win-2019-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,13 @@ jobs:
curl -Lo libmicrohttpd-latest-w32-bin.zip https://ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-latest-w32-bin.zip
unzip libmicrohttpd-latest-w32-bin.zip

- name: Install pre-compiled Readline Win64
run: |
curl -Lo readline-5.0-1-lib.zip https://github.com/neodiX42/precompiled-openssl-win64/raw/main/readline-5.0-1-lib.zip
unzip readline-5.0-1-lib.zip

- name: Compile
run: |
set root=%cd%
echo %root%
mkdir build
cd build
cmake -DREADLINE_INCLUDE_DIR=%root%\readline-5.0-1-lib\include\readline -DREADLINE_LIBRARY=%root%\readline-5.0-1-lib\lib\readline.lib -DZLIB_FOUND=1 -DMHD_FOUND=1 -DMHD_LIBRARY=%root%\libmicrohttpd-0.9.75-w32-bin\x86_64\VS2019\Release-static\libmicrohttpd.lib -DMHD_INCLUDE_DIR=%root%\libmicrohttpd-0.9.75-w32-bin\x86_64\VS2019\Release-static -DZLIB_INCLUDE_DIR=%root%\zlib -DZLIB_LIBRARY=%root%\zlib\contrib\vstudio\vc14\x64\ZlibStatReleaseWithoutAsm\zlibstat.lib -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=%root%/openssl-1.1/x64/include -DOPENSSL_CRYPTO_LIBRARY=%root%/openssl-1.1/x64/lib/libcrypto.lib -DCMAKE_CXX_FLAGS="/DTD_WINDOWS=1 /EHsc /bigobj /W0" ..
cmake -DPORTABLE=1 -DZLIB_FOUND=1 -DMHD_FOUND=1 -DMHD_LIBRARY=%root%\libmicrohttpd-0.9.75-w32-bin\x86_64\VS2019\Release-static\libmicrohttpd.lib -DMHD_INCLUDE_DIR=%root%\libmicrohttpd-0.9.75-w32-bin\x86_64\VS2019\Release-static -DZLIB_INCLUDE_DIR=%root%\zlib -DZLIB_LIBRARY=%root%\zlib\contrib\vstudio\vc14\x64\ZlibStatReleaseWithoutAsm\zlibstat.lib -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=%root%/openssl-1.1/x64/include -DOPENSSL_CRYPTO_LIBRARY=%root%/openssl-1.1/x64/lib/libcrypto.lib -DCMAKE_CXX_FLAGS="/DTD_WINDOWS=1 /EHsc /bigobj /W0" ..
cmake --build . --target 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 --config Release

- name: Show executables
Expand Down
9 changes: 9 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 2023.05 Update
1. Archive manager optimization
2. A series of catchain (basic consensus protocol) security improvements
3. Update for Fift libraries and FunC: better error-handling, fixes for `catch` stack recovery
4. A series of out message queue handling optimization (already deployed during emergency upgrades between releases)
5. Improvement of binaries portability

Besides the work of the core team, this update is based on the efforts of @aleksej-paschenko (portability improvement), [Disintar team](https://github.com/disintar/) (archive manager optimization) and [sec3-service](https://github.com/sec3-service) security auditors (funC improvements).

## 2023.04 Update
1. CPU load optimization: previous DHT reconnect policy was too aggressive
2. Network throughput improvements: granular control on external message broadcast, optimize celldb GC, adjust state serialization and block downloading timings, rldp2 for states and archives
Expand Down
1 change: 1 addition & 0 deletions catchain/catchain-receiver-interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class CatChainReceiverInterface : public td::actor::Actor {
td::BufferSlice query, td::uint64 max_answer_size,
td::actor::ActorId<adnl::AdnlSenderInterface> via) = 0;
virtual void send_custom_message_data(const PublicKeyHash &dst, td::BufferSlice query) = 0;
virtual void on_blame_processed(td::uint32 source_id) = 0;

virtual void destroy() = 0;

Expand Down
27 changes: 18 additions & 9 deletions catchain/catchain-receiver-source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ td::Result<std::unique_ptr<CatChainReceiverSource>> CatChainReceiverSource::crea

void CatChainReceiverSourceImpl::blame(td::uint32 fork, CatChainBlockHeight height) {
blame();
if (!blamed_heights_.empty()) {
if (blamed_heights_.size() <= fork) {
blamed_heights_.resize(fork + 1, 0);
}
if (blamed_heights_[fork] == 0 || blamed_heights_[fork] > height) {
VLOG(CATCHAIN_INFO) << this << ": blamed at " << fork << " " << height;
blamed_heights_[fork] = height;
}
// if (!blamed_heights_.empty()) {
if (blamed_heights_.size() <= fork) {
blamed_heights_.resize(fork + 1, 0);
}
if (blamed_heights_[fork] == 0 || blamed_heights_[fork] > height) {
VLOG(CATCHAIN_INFO) << this << ": blamed at " << fork << " " << height;
blamed_heights_[fork] = height;
}
// }
}

void CatChainReceiverSourceImpl::blame() {
Expand Down Expand Up @@ -144,7 +144,7 @@ void CatChainReceiverSourceImpl::on_new_block(CatChainReceivedBlock *block) {
on_found_fork_proof(create_serialize_tl_object<ton_api::catchain_block_data_fork>(block->export_tl_dep(),
it->second->export_tl_dep())
.as_slice());
chain_->add_prepared_event(fork_proof());
chain_->on_found_fork_proof(id_, fork_proof());
}
blame();
return;
Expand All @@ -162,6 +162,15 @@ void CatChainReceiverSourceImpl::on_found_fork_proof(const td::Slice &proof) {
}
}

bool CatChainReceiverSourceImpl::allow_send_block(CatChainBlockHash hash) {
td::uint32 count = ++block_requests_count_[hash];
if (count > MAX_BLOCK_REQUESTS) {
VLOG(CATCHAIN_INFO) << this << ": node requested block " << hash << " " << count << " times";
return false;
}
return true;
}

} // namespace catchain

} // namespace ton
3 changes: 3 additions & 0 deletions catchain/catchain-receiver-source.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class CatChainReceiverSource {
virtual td::BufferSlice fork_proof() const = 0;
virtual bool fork_is_found() const = 0;

// One block can be sent to one node only a limited number of times to prevent DoS
virtual bool allow_send_block(CatChainBlockHash hash) = 0;

static td::Result<std::unique_ptr<CatChainReceiverSource>> create(CatChainReceiver *chain, PublicKey pub_key,
adnl::AdnlNodeIdShort adnl_id, td::uint32 id);

Expand Down
7 changes: 7 additions & 0 deletions catchain/catchain-receiver-source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ class CatChainReceiverSourceImpl : public CatChainReceiverSource {
return chain_;
}

bool allow_send_block(CatChainBlockHash hash) override;

CatChainReceiverSourceImpl(CatChainReceiver *chain, PublicKey source, adnl::AdnlNodeIdShort adnl_id, td::uint32 id);

private:
Expand All @@ -130,6 +132,11 @@ class CatChainReceiverSourceImpl : public CatChainReceiverSource {

CatChainBlockHeight delivered_height_ = 0;
CatChainBlockHeight received_height_ = 0;

std::map<CatChainBlockHash, td::uint32> block_requests_count_;
// One block can be sent to one node up to 5 times

static const td::uint32 MAX_BLOCK_REQUESTS = 5;
};

} // namespace catchain
Expand Down
Loading