Skip to content

Commit 570da56

Browse files
authored
Merge pull request #436 from ton-blockchain/testnet
Fix validator session options hash
2 parents ce65245 + 054c578 commit 570da56

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

Changelog.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,17 @@
1212
* Improved Liteserver DoS resistance for running getmethods.
1313

1414
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).
15+
## 08.2022 Update
16+
* Blockchain state serialization now works via separate db-handler which simplfies memory clearing after serialization
17+
* CellDB now works asynchronously which substantially increase database access throughput
18+
* Abseil-cpp and crc32 updated: solve issues with compilation on recent OS distributives
19+
* Fixed a series of UBs and issues for exotic endianness hosts
20+
* Added detailed network stats for overlays (can be accessed via `validator-console`)
21+
* Improved auto-builds for wide range of systems.
22+
* Added extended error information for unaccepted external messages: `exit_code` and TVM trace (where applicable).
23+
* [Improved catchain DoS resistance](https://github.com/ton-blockchain/ton/blob/master/doc/catchain-dos.md)
24+
* A series of FunC improvements, summarized [here](https://github.com/ton-blockchain/ton/pull/378)
25+
#### Update delay
26+
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.
27+
28+
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.

tl/generate/scheme/ton_api.tl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,12 @@ validatorSession.config catchain_idle_timeout:double catchain_max_deps:int round
311311
max_round_attempts:int max_block_size:int max_collated_data_size:int = validatorSession.Config;
312312
validatorSession.configNew catchain_idle_timeout:double catchain_max_deps:int round_candidates:int next_candidate_delay:double round_attempt_duration:int
313313
max_round_attempts:int max_block_size:int max_collated_data_size:int new_catchain_ids:Bool = validatorSession.Config;
314+
validatorSession.configVersioned catchain_idle_timeout:double catchain_max_deps:int round_candidates:int next_candidate_delay:double round_attempt_duration:int
315+
max_round_attempts:int max_block_size:int max_collated_data_size:int version:int = validatorSession.Config;
314316

315317
validatorSession.catchainOptions idle_timeout:double max_deps:int max_block_size:int block_hash_covers_data:Bool
316318
max_block_height_ceoff:int debug_disable_db:Bool = validatorSession.CatChainOptions;
317-
validatorSession.configVersioned catchain_opts:validatorSession.CatChainOptions round_candidates:int next_candidate_delay:double
319+
validatorSession.configVersionedV2 catchain_opts:validatorSession.CatChainOptions round_candidates:int next_candidate_delay:double
318320
round_attempt_duration:int max_round_attempts:int max_block_size:int max_collated_data_size:int version:int = validatorSession.Config;
319321

320322
---functions---

tl/generate/scheme/ton_api.tlo

472 Bytes
Binary file not shown.

validator-session/validator-session.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ td::actor::ActorOwn<ValidatorSession> ValidatorSession::create(
882882
}
883883

884884
td::Bits256 ValidatorSessionOptions::get_hash() const {
885-
if(!proto_version) {
885+
if (proto_version == 0) {
886886
if (!new_catchain_ids) {
887887
return create_hash_tl_object<ton_api::validatorSession_config>(
888888
catchain_opts.idle_timeout, catchain_opts.max_deps, round_candidates, next_candidate_delay,
@@ -892,13 +892,17 @@ td::Bits256 ValidatorSessionOptions::get_hash() const {
892892
catchain_opts.idle_timeout, catchain_opts.max_deps, round_candidates, next_candidate_delay,
893893
round_attempt_duration, max_round_attempts, max_block_size, max_collated_data_size, new_catchain_ids);
894894
}
895-
} else {
895+
} else if (proto_version == 1) {
896896
return create_hash_tl_object<ton_api::validatorSession_configVersioned>(
897+
catchain_opts.idle_timeout, catchain_opts.max_deps, round_candidates, next_candidate_delay,
898+
round_attempt_duration, max_round_attempts, max_block_size, max_collated_data_size, proto_version);
899+
} else {
900+
return create_hash_tl_object<ton_api::validatorSession_configVersionedV2>(
897901
create_tl_object<ton_api::validatorSession_catchainOptions>(
898902
catchain_opts.idle_timeout, catchain_opts.max_deps, catchain_opts.max_serialized_block_size,
899903
catchain_opts.block_hash_covers_data, catchain_opts.max_block_height_coeff, catchain_opts.debug_disable_db),
900-
round_candidates, next_candidate_delay, round_attempt_duration,
901-
max_round_attempts, max_block_size, max_collated_data_size, proto_version);
904+
round_candidates, next_candidate_delay, round_attempt_duration, max_round_attempts, max_block_size,
905+
max_collated_data_size, proto_version);
902906
}
903907
}
904908

validator/manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,8 +1726,8 @@ void ValidatorManagerImpl::update_shards() {
17261726
td::uint32 threshold = 9407194;
17271727
bool force_group_id_upgrade = last_masterchain_seqno_ == threshold;
17281728
auto legacy_opts_hash = opts.get_hash();
1729-
if(last_masterchain_seqno_ >= threshold) { //TODO move to get_consensus_config()
1730-
opts.proto_version = 1;
1729+
if (last_masterchain_seqno_ >= threshold) { //TODO move to get_consensus_config()
1730+
opts.proto_version = std::max<td::uint32>(opts.proto_version, 1);
17311731
}
17321732
auto opts_hash = opts.get_hash();
17331733

0 commit comments

Comments
 (0)