1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Merge pull request #436 from ton-blockchain/testnet

Fix validator session options hash
This commit is contained in:
EmelyanenkoK 2022-08-10 10:16:27 +03:00 committed by GitHub
commit 570da56a9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 7 deletions

View file

@ -12,3 +12,17 @@
* Improved Liteserver DoS resistance for running getmethods. * 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). 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 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.

View file

@ -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; 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 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; 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 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; 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; round_attempt_duration:int max_round_attempts:int max_block_size:int max_collated_data_size:int version:int = validatorSession.Config;
---functions--- ---functions---

Binary file not shown.

View file

@ -882,7 +882,7 @@ td::actor::ActorOwn<ValidatorSession> ValidatorSession::create(
} }
td::Bits256 ValidatorSessionOptions::get_hash() const { td::Bits256 ValidatorSessionOptions::get_hash() const {
if(!proto_version) { if (proto_version == 0) {
if (!new_catchain_ids) { if (!new_catchain_ids) {
return create_hash_tl_object<ton_api::validatorSession_config>( return create_hash_tl_object<ton_api::validatorSession_config>(
catchain_opts.idle_timeout, catchain_opts.max_deps, round_candidates, next_candidate_delay, 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, 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); 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<ton_api::validatorSession_configVersioned>( return create_hash_tl_object<ton_api::validatorSession_configVersioned>(
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<ton_api::validatorSession_configVersionedV2>(
create_tl_object<ton_api::validatorSession_catchainOptions>( create_tl_object<ton_api::validatorSession_catchainOptions>(
catchain_opts.idle_timeout, catchain_opts.max_deps, catchain_opts.max_serialized_block_size, 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), 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, round_candidates, next_candidate_delay, round_attempt_duration, max_round_attempts, max_block_size,
max_round_attempts, max_block_size, max_collated_data_size, proto_version); max_collated_data_size, proto_version);
} }
} }

View file

@ -1726,8 +1726,8 @@ void ValidatorManagerImpl::update_shards() {
td::uint32 threshold = 9407194; td::uint32 threshold = 9407194;
bool force_group_id_upgrade = last_masterchain_seqno_ == threshold; bool force_group_id_upgrade = last_masterchain_seqno_ == threshold;
auto legacy_opts_hash = opts.get_hash(); auto legacy_opts_hash = opts.get_hash();
if(last_masterchain_seqno_ >= threshold) { //TODO move to get_consensus_config() if (last_masterchain_seqno_ >= threshold) { //TODO move to get_consensus_config()
opts.proto_version = 1; opts.proto_version = std::max<td::uint32>(opts.proto_version, 1);
} }
auto opts_hash = opts.get_hash(); auto opts_hash = opts.get_hash();