From 30ba32bef990f4057996ec3cfb2e496114e534f5 Mon Sep 17 00:00:00 2001 From: SpyCheese Date: Tue, 9 Aug 2022 13:18:06 +0300 Subject: [PATCH 1/3] Fix validator session options hash; fix proto_version --- tl/generate/scheme/ton_api.tl | 4 +++- tl/generate/scheme/ton_api.tlo | Bin 66724 -> 67196 bytes validator-session/validator-session.cpp | 12 ++++++++---- validator/manager.cpp | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tl/generate/scheme/ton_api.tl b/tl/generate/scheme/ton_api.tl index a1fddf2b..87dadd8a 100644 --- a/tl/generate/scheme/ton_api.tl +++ b/tl/generate/scheme/ton_api.tl @@ -311,10 +311,12 @@ validatorSession.config catchain_idle_timeout:double catchain_max_deps:int round max_round_attempts:int max_block_size:int max_collated_data_size:int = validatorSession.Config; validatorSession.configNew catchain_idle_timeout:double catchain_max_deps:int round_candidates:int next_candidate_delay:double round_attempt_duration:int max_round_attempts:int max_block_size:int max_collated_data_size:int new_catchain_ids:Bool = validatorSession.Config; +validatorSession.configVersioned catchain_idle_timeout:double catchain_max_deps:int round_candidates:int next_candidate_delay:double round_attempt_duration:int + max_round_attempts:int max_block_size:int max_collated_data_size:int version:int = validatorSession.Config; validatorSession.catchainOptions idle_timeout:double max_deps:int max_block_size:int block_hash_covers_data:Bool max_block_height_ceoff:int debug_disable_db:Bool = validatorSession.CatChainOptions; -validatorSession.configVersioned catchain_opts:validatorSession.CatChainOptions round_candidates:int next_candidate_delay:double +validatorSession.configVersionedV2 catchain_opts:validatorSession.CatChainOptions round_candidates:int next_candidate_delay:double round_attempt_duration:int max_round_attempts:int max_block_size:int max_collated_data_size:int version:int = validatorSession.Config; ---functions--- diff --git a/tl/generate/scheme/ton_api.tlo b/tl/generate/scheme/ton_api.tlo index dd308bc0040c8e17b01d8f9698e6db5fd3b48c1d..9fb0cc4371598866241af28d9d103d99f314bafd 100644 GIT binary patch delta 171 zcmZ3|$?~U%Wy1z#+0U2euMjUw%*jkiEXgklPAx9Z%+J$v&d*EBOlO(sD8BiLvIHZe z&E~%<#*0}%iZ`2_s9^-NCT}^Z0}*<1as{IZNRj~xuF7%6Fi+QVn7rV$3QS1_1db23vBOY)0?Q;Ul;^Yiqa^YhX&)0rnaif?|REWyZV zz4@<-@nTMp;+w~Wd^k3rJ)O@ud4n1U3rJ}4mXkVQ#^w{JD;OuooHh^v2{S;!RXMI0 Zk29e{lNX#;fhb#WHiHqu;yGVn4ge`fHHrWL diff --git a/validator-session/validator-session.cpp b/validator-session/validator-session.cpp index 4edd3d58..a57d33c3 100644 --- a/validator-session/validator-session.cpp +++ b/validator-session/validator-session.cpp @@ -882,7 +882,7 @@ td::actor::ActorOwn ValidatorSession::create( } td::Bits256 ValidatorSessionOptions::get_hash() const { - if(!proto_version) { + if (proto_version == 0) { if (!new_catchain_ids) { return create_hash_tl_object( catchain_opts.idle_timeout, catchain_opts.max_deps, round_candidates, next_candidate_delay, @@ -892,13 +892,17 @@ td::Bits256 ValidatorSessionOptions::get_hash() const { catchain_opts.idle_timeout, catchain_opts.max_deps, round_candidates, next_candidate_delay, round_attempt_duration, max_round_attempts, max_block_size, max_collated_data_size, new_catchain_ids); } - } else { + } else if (proto_version == 1) { return create_hash_tl_object( + catchain_opts.idle_timeout, catchain_opts.max_deps, round_candidates, next_candidate_delay, + round_attempt_duration, max_round_attempts, max_block_size, max_collated_data_size, proto_version); + } else { + return create_hash_tl_object( create_tl_object( catchain_opts.idle_timeout, catchain_opts.max_deps, catchain_opts.max_serialized_block_size, catchain_opts.block_hash_covers_data, catchain_opts.max_block_height_coeff, catchain_opts.debug_disable_db), - round_candidates, next_candidate_delay, round_attempt_duration, - max_round_attempts, max_block_size, max_collated_data_size, proto_version); + round_candidates, next_candidate_delay, round_attempt_duration, max_round_attempts, max_block_size, + max_collated_data_size, proto_version); } } diff --git a/validator/manager.cpp b/validator/manager.cpp index c33d23c2..80356ef0 100644 --- a/validator/manager.cpp +++ b/validator/manager.cpp @@ -1726,8 +1726,8 @@ void ValidatorManagerImpl::update_shards() { td::uint32 threshold = 9407194; bool force_group_id_upgrade = last_masterchain_seqno_ == threshold; auto legacy_opts_hash = opts.get_hash(); - if(last_masterchain_seqno_ >= threshold) { //TODO move to get_consensus_config() - opts.proto_version = 1; + if (last_masterchain_seqno_ >= threshold) { //TODO move to get_consensus_config() + opts.proto_version = std::max(opts.proto_version, 1); } auto opts_hash = opts.get_hash(); From f2155c4a0c7b273f704af9d61f51c8edfd63c883 Mon Sep 17 00:00:00 2001 From: EmelyanenkoK Date: Tue, 9 Aug 2022 16:05:40 +0300 Subject: [PATCH 2/3] Update Changelog.md --- Changelog.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Changelog.md b/Changelog.md index e9052c0b..65522f5f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -12,3 +12,15 @@ * Improved Liteserver DoS resistance for running getmethods. Besides the work of the core team, this update is based on the efforts of @tvorogme (added support for slice arguments and noted bugs in Asm.fif), @akifoq (fixed bug in Asm.fif), @cryshado (noted strange behavior of LS, which, upon inspection, turned out to be a vector of DoS attack). +## 08.2022 Update +* Blockchain state serialization now works via separate db-handler which simplfies memory clearing after serialization +* CellDB now works asynchronously which substantially increase database access throughput +* Abseil-cpp and crc32 updated: solve issues with compilation on recent OS distributives +* Fixed a series of UBs and issues for exotic endianness hosts +* Added detailed network stats for overlays (can be accessed via `validator-console`) +* Improved auto-builds for wide range of systems. +* Added extended error information for unaccepted external messages: `exit_code` and TVM trace (where applicable). +* [Improved catchain DoS resistance](https://github.com/ton-blockchain/ton/blob/master/doc/catchain-dos.md) +* A series of FunC improvements, summarized [here](https://github.com/ton-blockchain/ton/pull/378) +### Update accident +Update coincided with persistent state serialization event which lead to block production speed deterioration (issue substantially mitigated in update itself). This phenomena was aggravated by the fact that after update some validators lost ability to participate in block creation. The former was caused by threshold based hardcoded protocol version bump, where threshold was set in such manner (based on block height with value higher than 9m), that it eluded detection in private net tests. The update was temporarily paused and resumed after persistent state serialization ended and issues with block creation were resolved. From 054c5780d9c45460aa6fd6adbd7aef0ba1b8f41e Mon Sep 17 00:00:00 2001 From: EmelyanenkoK Date: Wed, 10 Aug 2022 10:14:36 +0300 Subject: [PATCH 3/3] Add acknowledgments to Changelog --- Changelog.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 65522f5f..b4749780 100644 --- a/Changelog.md +++ b/Changelog.md @@ -22,5 +22,7 @@ Besides the work of the core team, this update is based on the efforts of @tvoro * Added extended error information for unaccepted external messages: `exit_code` and TVM trace (where applicable). * [Improved catchain DoS resistance](https://github.com/ton-blockchain/ton/blob/master/doc/catchain-dos.md) * A series of FunC improvements, summarized [here](https://github.com/ton-blockchain/ton/pull/378) -### Update accident -Update coincided with persistent state serialization event which lead to block production speed deterioration (issue substantially mitigated in update itself). This phenomena was aggravated by the fact that after update some validators lost ability to participate in block creation. The former was caused by threshold based hardcoded protocol version bump, where threshold was set in such manner (based on block height with value higher than 9m), that it eluded detection in private net tests. The update was temporarily paused and resumed after persistent state serialization ended and issues with block creation were resolved. +#### Update delay +Update coincided with persistent state serialization event which lead to block production speed deterioration (issue substantially mitigated in update itself). This phenomena was aggravated by the fact that after update some validators lost ability to participate in block creation. The last was caused by threshold based hardcoded protocol version bump, where threshold was set in such manner (based on block height with value higher than 9m), that it eluded detection in private net tests. The update was temporarily paused and resumed after persistent state serialization ended and issues with block creation were resolved. + +Besides the work of the core team, this update is based on the efforts of @awesome-doge (help with abseil-cpp upgrade), @rec00rsiff (noted issues for exotic endianess and implemented network stats) and third-party security auditors.