mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Rework validator-collator interaction
1) Remove config 41, move "full collated data" to capabilities 2) Whitelist on collator nodes 3) "Ping" request for collator nodes 4) More customizable collators list for validators 5) CollationManager
This commit is contained in:
parent
7d2110c8b0
commit
b3bea413e3
34 changed files with 1204 additions and 319 deletions
|
@ -45,7 +45,7 @@ class Collator final : public td::actor::Actor {
|
|||
}
|
||||
static constexpr long long supported_capabilities() {
|
||||
return ton::capCreateStatsEnabled | ton::capBounceMsgBody | ton::capReportVersion | ton::capShortDequeue |
|
||||
ton::capStoreOutMsgQueueSize | ton::capMsgMetadata | ton::capDeferMessages;
|
||||
ton::capStoreOutMsgQueueSize | ton::capMsgMetadata | ton::capDeferMessages | ton::capFullCollatedData;
|
||||
}
|
||||
using LtCellRef = block::LtCellRef;
|
||||
using NewOutMsg = block::NewOutMsg;
|
||||
|
|
|
@ -730,6 +730,8 @@ bool Collator::unpack_last_mc_state() {
|
|||
store_out_msg_queue_size_ = config_->has_capability(ton::capStoreOutMsgQueueSize);
|
||||
msg_metadata_enabled_ = config_->has_capability(ton::capMsgMetadata);
|
||||
deferring_messages_enabled_ = config_->has_capability(ton::capDeferMessages);
|
||||
full_collated_data_ = config_->has_capability(capFullCollatedData);
|
||||
LOG(DEBUG) << "full_collated_data is " << full_collated_data_;
|
||||
shard_conf_ = std::make_unique<block::ShardConfig>(*config_);
|
||||
prev_key_block_exists_ = config_->get_last_key_block(prev_key_block_, prev_key_block_lt_);
|
||||
if (prev_key_block_exists_) {
|
||||
|
@ -768,8 +770,6 @@ bool Collator::unpack_last_mc_state() {
|
|||
<< " have been enabled in global configuration, but we support only " << supported_version()
|
||||
<< " (upgrade validator software?)";
|
||||
}
|
||||
full_collated_data_ = config_->get_collator_config(false).full_collated_data;
|
||||
LOG(DEBUG) << "full_collated_data is " << full_collated_data_;
|
||||
// TODO: extract start_lt and end_lt from prev_mc_block as well
|
||||
// std::cerr << " block::gen::ShardState::print_ref(mc_state_root) = ";
|
||||
// block::gen::t_ShardState.print_ref(std::cerr, mc_state_root, 2);
|
||||
|
@ -817,6 +817,9 @@ bool Collator::request_neighbor_msg_queues() {
|
|||
auto neighbor_list = shard_conf_->get_neighbor_shard_hash_ids(shard_);
|
||||
LOG(DEBUG) << "got a preliminary list of " << neighbor_list.size() << " neighbors for " << shard_.to_str();
|
||||
for (ton::BlockId blk_id : neighbor_list) {
|
||||
if (blk_id.seqno == 0 && blk_id.shard_full() != shard_) {
|
||||
continue;
|
||||
}
|
||||
auto shard_ptr = shard_conf_->get_shard_hash(ton::ShardIdFull(blk_id));
|
||||
if (shard_ptr.is_null()) {
|
||||
return fatal_error(-667, "cannot obtain shard hash for neighbor "s + blk_id.to_str());
|
||||
|
|
|
@ -170,9 +170,6 @@ class MasterchainStateQ : public MasterchainState, public ShardStateQ {
|
|||
block::WorkchainSet get_workchain_list() const override {
|
||||
return config_ ? config_->get_workchain_list() : block::WorkchainSet();
|
||||
}
|
||||
block::CollatorConfig get_collator_config(bool need_collator_nodes) const override {
|
||||
return config_ ? config_->get_collator_config(need_collator_nodes) : block::CollatorConfig();
|
||||
}
|
||||
|
||||
private:
|
||||
ZeroStateIdExt zerostate_id_;
|
||||
|
|
|
@ -1536,6 +1536,9 @@ bool ValidateQuery::request_neighbor_queues() {
|
|||
auto neighbor_list = new_shard_conf_->get_neighbor_shard_hash_ids(shard_);
|
||||
LOG(DEBUG) << "got a preliminary list of " << neighbor_list.size() << " neighbors for " << shard_.to_str();
|
||||
for (ton::BlockId blk_id : neighbor_list) {
|
||||
if (blk_id.seqno == 0 && blk_id.shard_full() != shard_) {
|
||||
continue;
|
||||
}
|
||||
auto shard_ptr = new_shard_conf_->get_shard_hash(ton::ShardIdFull(blk_id));
|
||||
if (shard_ptr.is_null()) {
|
||||
return reject_query("cannot obtain shard hash for neighbor "s + blk_id.to_str());
|
||||
|
@ -2305,6 +2308,12 @@ bool ValidateQuery::prepare_out_msg_queue_size() {
|
|||
have_out_msg_queue_size_in_state_ = true;
|
||||
return true;
|
||||
}
|
||||
if (ps_.out_msg_queue_->is_empty()) {
|
||||
old_out_msg_queue_size_ = 0;
|
||||
out_msg_queue_size_known_ = true;
|
||||
have_out_msg_queue_size_in_state_ = true;
|
||||
return true;
|
||||
}
|
||||
if (!store_out_msg_queue_size_) { // Don't need it
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ class ValidateQuery : public td::actor::Actor {
|
|||
}
|
||||
static constexpr long long supported_capabilities() {
|
||||
return ton::capCreateStatsEnabled | ton::capBounceMsgBody | ton::capReportVersion | ton::capShortDequeue |
|
||||
ton::capStoreOutMsgQueueSize | ton::capMsgMetadata | ton::capDeferMessages;
|
||||
ton::capStoreOutMsgQueueSize | ton::capMsgMetadata | ton::capDeferMessages | ton::capFullCollatedData;
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -50,6 +50,7 @@ class ValidatorSetQ : public ValidatorSet {
|
|||
td::Ref<BlockSignatureSet> signatures) const override;
|
||||
td::Result<ValidatorWeight> check_approve_signatures(RootHash root_hash, FileHash file_hash,
|
||||
td::Ref<BlockSignatureSet> signatures) const override;
|
||||
const ValidatorDescr* find_validator(const NodeIdShort& id) const override;
|
||||
|
||||
ValidatorSetQ* make_copy() const override;
|
||||
|
||||
|
@ -62,8 +63,6 @@ class ValidatorSetQ : public ValidatorSet {
|
|||
ValidatorWeight total_weight_;
|
||||
std::vector<ValidatorDescr> ids_;
|
||||
std::vector<std::pair<NodeIdShort, size_t>> ids_map_;
|
||||
|
||||
const ValidatorDescr* find_validator(const NodeIdShort& id) const;
|
||||
};
|
||||
|
||||
class ValidatorSetCompute {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue