mirror of
				https://github.com/ton-blockchain/ton
				synced 2025-03-09 15:40:10 +00:00 
			
		
		
		
	Add versioned validatorSession.config
This commit is contained in:
		
							parent
							
								
									0f9b25d940
								
							
						
					
					
						commit
						29223952a0
					
				
					 5 changed files with 23 additions and 9 deletions
				
			
		|  | @ -307,6 +307,8 @@ validatorSession.candidate src:int256 round:int root_hash:int256 data:bytes coll | |||
| 
 | ||||
| validatorSession.config 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 = 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.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; | ||||
| 
 | ||||
|  |  | |||
										
											Binary file not shown.
										
									
								
							|  | @ -53,6 +53,8 @@ struct ValidatorSessionOptions { | |||
| 
 | ||||
|   bool new_catchain_ids = false; | ||||
| 
 | ||||
|   td::uint32 proto_version = 0; | ||||
| 
 | ||||
|   td::Bits256 get_hash() const; | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -881,19 +881,26 @@ td::actor::ActorOwn<ValidatorSession> ValidatorSession::create( | |||
| } | ||||
| 
 | ||||
| td::Bits256 ValidatorSessionOptions::get_hash() const { | ||||
|   if (!new_catchain_ids) { | ||||
|     return create_hash_tl_object<ton_api::validatorSession_config>( | ||||
|         catchain_idle_timeout, catchain_max_deps, round_candidates, next_candidate_delay, round_attempt_duration, | ||||
|         max_round_attempts, max_block_size, max_collated_data_size); | ||||
|   if(!proto_version) { | ||||
|     if (!new_catchain_ids) { | ||||
|         return create_hash_tl_object<ton_api::validatorSession_config>( | ||||
|             catchain_idle_timeout, catchain_max_deps, round_candidates, next_candidate_delay, round_attempt_duration, | ||||
|             max_round_attempts, max_block_size, max_collated_data_size); | ||||
|     } else { | ||||
|         return create_hash_tl_object<ton_api::validatorSession_configNew>( | ||||
|             catchain_idle_timeout, catchain_max_deps, round_candidates, next_candidate_delay, round_attempt_duration, | ||||
|             max_round_attempts, max_block_size, max_collated_data_size, new_catchain_ids); | ||||
|     } | ||||
|   } else { | ||||
|     return create_hash_tl_object<ton_api::validatorSession_configNew>( | ||||
|         catchain_idle_timeout, catchain_max_deps, round_candidates, next_candidate_delay, round_attempt_duration, | ||||
|         max_round_attempts, max_block_size, max_collated_data_size, new_catchain_ids); | ||||
|   } | ||||
|         return create_hash_tl_object<ton_api::validatorSession_configVersioned>( | ||||
|             catchain_idle_timeout, catchain_max_deps, round_candidates, next_candidate_delay, round_attempt_duration, | ||||
|             max_round_attempts, max_block_size, max_collated_data_size, proto_version); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| ValidatorSessionOptions::ValidatorSessionOptions(const ValidatorSessionConfig &conf) { | ||||
|   CHECK(!conf.proto_version); | ||||
|   proto_version = conf.proto_version; | ||||
|   catchain_idle_timeout = conf.catchain_idle_timeout; | ||||
|   catchain_max_deps = conf.catchain_max_deps; | ||||
|   max_block_size = conf.max_block_size; | ||||
|  |  | |||
|  | @ -1692,6 +1692,9 @@ void ValidatorManagerImpl::update_shards() { | |||
|   auto exp_vec = last_masterchain_state_->get_shards(); | ||||
|   auto config = last_masterchain_state_->get_consensus_config(); | ||||
|   validatorsession::ValidatorSessionOptions opts{config}; | ||||
|   if(last_masterchain_seqno_ > 9000000) { //TODO move to get_consensus_config()
 | ||||
|       opts.proto_version = 1; | ||||
|   } | ||||
|   auto opts_hash = opts.get_hash(); | ||||
| 
 | ||||
|   std::map<ShardIdFull, std::vector<BlockIdExt>> new_shards; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue