Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.

Commit 2922395

Browse files
committed
Add versioned validatorSession.config
1 parent 0f9b25d commit 2922395

File tree

5 files changed

+23
-9
lines changed

5 files changed

+23
-9
lines changed

Diff for: tl/generate/scheme/ton_api.tl

+2
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ validatorSession.candidate src:int256 round:int root_hash:int256 data:bytes coll
307307

308308
validatorSession.config catchain_idle_timeout:double catchain_max_deps:int round_candidates:int next_candidate_delay:double round_attempt_duration:int
309309
max_round_attempts:int max_block_size:int max_collated_data_size:int = validatorSession.Config;
310+
validatorSession.configVersioned catchain_idle_timeout:double catchain_max_deps:int round_candidates:int next_candidate_delay:double round_attempt_duration:int
311+
max_round_attempts:int max_block_size:int max_collated_data_size:int version:int = validatorSession.Config;
310312
validatorSession.configNew catchain_idle_timeout:double catchain_max_deps:int round_candidates:int next_candidate_delay:double round_attempt_duration:int
311313
max_round_attempts:int max_block_size:int max_collated_data_size:int new_catchain_ids:Bool = validatorSession.Config;
312314

Diff for: tl/generate/scheme/ton_api.tlo

472 Bytes
Binary file not shown.

Diff for: validator-session/validator-session-types.h

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ struct ValidatorSessionOptions {
5353

5454
bool new_catchain_ids = false;
5555

56+
td::uint32 proto_version = 0;
57+
5658
td::Bits256 get_hash() const;
5759
};
5860

Diff for: validator-session/validator-session.cpp

+16-9
Original file line numberDiff line numberDiff line change
@@ -881,19 +881,26 @@ td::actor::ActorOwn<ValidatorSession> ValidatorSession::create(
881881
}
882882

883883
td::Bits256 ValidatorSessionOptions::get_hash() const {
884-
if (!new_catchain_ids) {
885-
return create_hash_tl_object<ton_api::validatorSession_config>(
886-
catchain_idle_timeout, catchain_max_deps, round_candidates, next_candidate_delay, round_attempt_duration,
887-
max_round_attempts, max_block_size, max_collated_data_size);
884+
if(!proto_version) {
885+
if (!new_catchain_ids) {
886+
return create_hash_tl_object<ton_api::validatorSession_config>(
887+
catchain_idle_timeout, catchain_max_deps, round_candidates, next_candidate_delay, round_attempt_duration,
888+
max_round_attempts, max_block_size, max_collated_data_size);
889+
} else {
890+
return create_hash_tl_object<ton_api::validatorSession_configNew>(
891+
catchain_idle_timeout, catchain_max_deps, round_candidates, next_candidate_delay, round_attempt_duration,
892+
max_round_attempts, max_block_size, max_collated_data_size, new_catchain_ids);
893+
}
888894
} else {
889-
return create_hash_tl_object<ton_api::validatorSession_configNew>(
890-
catchain_idle_timeout, catchain_max_deps, round_candidates, next_candidate_delay, round_attempt_duration,
891-
max_round_attempts, max_block_size, max_collated_data_size, new_catchain_ids);
892-
}
895+
return create_hash_tl_object<ton_api::validatorSession_configVersioned>(
896+
catchain_idle_timeout, catchain_max_deps, round_candidates, next_candidate_delay, round_attempt_duration,
897+
max_round_attempts, max_block_size, max_collated_data_size, proto_version);
898+
}
899+
893900
}
894901

895902
ValidatorSessionOptions::ValidatorSessionOptions(const ValidatorSessionConfig &conf) {
896-
CHECK(!conf.proto_version);
903+
proto_version = conf.proto_version;
897904
catchain_idle_timeout = conf.catchain_idle_timeout;
898905
catchain_max_deps = conf.catchain_max_deps;
899906
max_block_size = conf.max_block_size;

Diff for: validator/manager.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1692,6 +1692,9 @@ void ValidatorManagerImpl::update_shards() {
16921692
auto exp_vec = last_masterchain_state_->get_shards();
16931693
auto config = last_masterchain_state_->get_consensus_config();
16941694
validatorsession::ValidatorSessionOptions opts{config};
1695+
if(last_masterchain_seqno_ > 9000000) { //TODO move to get_consensus_config()
1696+
opts.proto_version = 1;
1697+
}
16951698
auto opts_hash = opts.get_hash();
16961699

16971700
std::map<ShardIdFull, std::vector<BlockIdExt>> new_shards;

0 commit comments

Comments
 (0)