mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
validator: multiple bugfixes
This commit is contained in:
parent
7efb345e3d
commit
dfc040cb00
17 changed files with 255 additions and 65 deletions
|
@ -59,6 +59,7 @@ class Collator final : public td::actor::Actor {
|
|||
bool preinit_complete{false};
|
||||
bool is_key_block_{false};
|
||||
bool block_full_{false};
|
||||
bool outq_cleanup_partial_{false};
|
||||
bool inbound_queues_empty_{false};
|
||||
bool libraries_changed_{false};
|
||||
bool prev_key_block_exists_{false};
|
||||
|
@ -144,6 +145,8 @@ class Collator final : public td::actor::Actor {
|
|||
bool ihr_enabled_{false};
|
||||
bool create_stats_enabled_{false};
|
||||
bool report_version_{false};
|
||||
bool skip_topmsgdescr_{false};
|
||||
bool skip_extmsg_{false};
|
||||
td::uint64 overload_history_{0}, underload_history_{0};
|
||||
td::uint64 block_size_estimate_{};
|
||||
Ref<block::WorkchainInfo> wc_info_;
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "validator-set.hpp"
|
||||
#include "top-shard-descr.hpp"
|
||||
#include <ctime>
|
||||
#include "td/utils/Random.h"
|
||||
|
||||
namespace ton {
|
||||
|
||||
|
@ -1208,6 +1209,9 @@ bool Collator::import_new_shard_top_blocks() {
|
|||
if (shard_block_descr_.empty()) {
|
||||
return true;
|
||||
}
|
||||
if (skip_topmsgdescr_) {
|
||||
return true;
|
||||
}
|
||||
auto lt_limit = config_->lt + config_->get_max_lt_growth();
|
||||
std::sort(shard_block_descr_.begin(), shard_block_descr_.end(), cmp_shard_block_descr_ref);
|
||||
int tb_act = 0;
|
||||
|
@ -1442,6 +1446,37 @@ bool Collator::init_utime() {
|
|||
"error initializing unix time for the new block: failed to observe end of fsm_split time interval for this "
|
||||
"shard");
|
||||
}
|
||||
// check whether masterchain catchain rotation is overdue
|
||||
auto ccvc = config_->get_catchain_validators_config();
|
||||
unsigned lifetime = ccvc.mc_cc_lifetime;
|
||||
if (is_masterchain() && now_ / lifetime > prev_now_ / lifetime && now_ > (prev_now_ / lifetime + 1) * lifetime + 20) {
|
||||
auto overdue = now_ - (prev_now_ / lifetime + 1) * lifetime;
|
||||
// masterchain catchain rotation overdue, skip topsharddescr with some probability
|
||||
skip_topmsgdescr_ = (td::Random::fast(0, 1023) < 256); // probability 1/4
|
||||
skip_extmsg_ = (td::Random::fast(0, 1023) < 256); // skip ext msg probability 1/4
|
||||
if (skip_topmsgdescr_) {
|
||||
LOG(WARNING)
|
||||
<< "randomly skipping import of new shard data because of overdue masterchain catchain rotation (overdue by "
|
||||
<< overdue << " seconds)";
|
||||
}
|
||||
if (skip_extmsg_) {
|
||||
LOG(WARNING)
|
||||
<< "randomly skipping external message import because of overdue masterchain catchain rotation (overdue by "
|
||||
<< overdue << " seconds)";
|
||||
}
|
||||
} else if (is_masterchain() && now_ > prev_now_ + 60) {
|
||||
auto interval = now_ - prev_now_;
|
||||
skip_topmsgdescr_ = (td::Random::fast(0, 1023) < 128); // probability 1/8
|
||||
skip_extmsg_ = (td::Random::fast(0, 1023) < 128); // skip ext msg probability 1/8
|
||||
if (skip_topmsgdescr_) {
|
||||
LOG(WARNING) << "randomly skipping import of new shard data because of overdue masterchain block (last block was "
|
||||
<< interval << " seconds ago)";
|
||||
}
|
||||
if (skip_extmsg_) {
|
||||
LOG(WARNING) << "randomly skipping external message import because of overdue masterchain block (last block was "
|
||||
<< interval << " seconds ago)";
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1742,7 +1777,7 @@ bool Collator::dequeue_message(Ref<vm::Cell> msg_envelope, ton::LogicalTime deli
|
|||
}
|
||||
|
||||
bool Collator::out_msg_queue_cleanup() {
|
||||
LOG(DEBUG) << "in out_msg_queue_cleanup()";
|
||||
LOG(INFO) << "cleaning outbound queue from messages already imported by neighbors";
|
||||
if (verbosity >= 2) {
|
||||
auto rt = out_msg_queue_->get_root();
|
||||
std::cerr << "old out_msg_queue is ";
|
||||
|
@ -1759,6 +1794,11 @@ bool Collator::out_msg_queue_cleanup() {
|
|||
auto res = out_msg_queue_->filter([&](vm::CellSlice& cs, td::ConstBitPtr key, int n) -> int {
|
||||
assert(n == 352);
|
||||
// LOG(DEBUG) << "key is " << key.to_hex(n);
|
||||
if (block_full_) {
|
||||
LOG(WARNING) << "BLOCK FULL while cleaning up outbound queue, cleanup completed only partially";
|
||||
outq_cleanup_partial_ = true;
|
||||
return (1 << 30) + 1; // retain all remaining outbound queue entries including this one without processing
|
||||
}
|
||||
block::EnqueuedMsgDescr enq_msg_descr;
|
||||
unsigned long long created_lt;
|
||||
if (!(cs.fetch_ulong_bool(64, created_lt) // augmentation
|
||||
|
@ -1789,6 +1829,10 @@ bool Collator::out_msg_queue_cleanup() {
|
|||
<< enq_msg_descr.hash_.to_hex() << ") by inserting a msg_export_deq record");
|
||||
return -1;
|
||||
}
|
||||
register_out_msg_queue_op();
|
||||
if (!block_limit_status_->fits(block::ParamLimits::cl_normal)) {
|
||||
block_full_ = true;
|
||||
}
|
||||
}
|
||||
return !delivered;
|
||||
});
|
||||
|
@ -2631,6 +2675,10 @@ bool Collator::process_inbound_internal_messages() {
|
|||
}
|
||||
|
||||
bool Collator::process_inbound_external_messages() {
|
||||
if (skip_extmsg_) {
|
||||
LOG(INFO) << "skipping processing of inbound external messages";
|
||||
return true;
|
||||
}
|
||||
bool full = !block_limit_status_->fits(block::ParamLimits::cl_soft);
|
||||
for (auto& ext_msg_pair : ext_msg_list_) {
|
||||
if (full) {
|
||||
|
|
|
@ -204,7 +204,7 @@ void LiteQuery::perform_getMasterchainInfo(int mode) {
|
|||
}
|
||||
td::actor::send_closure_later(
|
||||
manager_, &ton::validator::ValidatorManager::get_top_masterchain_state_block,
|
||||
[Self = actor_id(this), mode](td::Result<std::pair<Ref<ton::validator::MasterchainState>, BlockIdExt>> res) {
|
||||
[ Self = actor_id(this), mode ](td::Result<std::pair<Ref<ton::validator::MasterchainState>, BlockIdExt>> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query, res.move_as_error());
|
||||
} else {
|
||||
|
@ -242,7 +242,7 @@ void LiteQuery::perform_getBlock(BlockIdExt blkid) {
|
|||
return;
|
||||
}
|
||||
td::actor::send_closure_later(manager_, &ValidatorManager::get_block_data_from_db_short, blkid,
|
||||
[Self = actor_id(this), blkid](td::Result<Ref<ton::validator::BlockData>> res) {
|
||||
[ Self = actor_id(this), blkid ](td::Result<Ref<ton::validator::BlockData>> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query, res.move_as_error());
|
||||
} else {
|
||||
|
@ -268,7 +268,7 @@ void LiteQuery::perform_getBlockHeader(BlockIdExt blkid, int mode) {
|
|||
return;
|
||||
}
|
||||
td::actor::send_closure_later(manager_, &ValidatorManager::get_block_data_from_db_short, blkid,
|
||||
[Self = actor_id(this), blkid, mode](td::Result<Ref<ton::validator::BlockData>> res) {
|
||||
[ Self = actor_id(this), blkid, mode ](td::Result<Ref<ton::validator::BlockData>> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query, res.move_as_error());
|
||||
} else {
|
||||
|
@ -383,7 +383,7 @@ void LiteQuery::perform_getState(BlockIdExt blkid) {
|
|||
}
|
||||
if (blkid.id.seqno) {
|
||||
td::actor::send_closure_later(manager_, &ValidatorManager::get_shard_state_from_db_short, blkid,
|
||||
[Self = actor_id(this), blkid](td::Result<Ref<ton::validator::ShardState>> res) {
|
||||
[ Self = actor_id(this), blkid ](td::Result<Ref<ton::validator::ShardState>> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query, res.move_as_error());
|
||||
} else {
|
||||
|
@ -393,7 +393,7 @@ void LiteQuery::perform_getState(BlockIdExt blkid) {
|
|||
});
|
||||
} else {
|
||||
td::actor::send_closure_later(manager_, &ValidatorManager::get_zero_state, blkid,
|
||||
[Self = actor_id(this), blkid](td::Result<td::BufferSlice> res) {
|
||||
[ Self = actor_id(this), blkid ](td::Result<td::BufferSlice> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query, res.move_as_error());
|
||||
} else {
|
||||
|
@ -452,7 +452,7 @@ bool LiteQuery::request_mc_block_data(BlockIdExt blkid) {
|
|||
++pending_;
|
||||
td::actor::send_closure_later(
|
||||
manager_, &ValidatorManager::get_block_data_from_db_short, blkid,
|
||||
[Self = actor_id(this), blkid](td::Result<Ref<BlockData>> res) {
|
||||
[ Self = actor_id(this), blkid ](td::Result<Ref<BlockData>> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query,
|
||||
res.move_as_error_prefix("cannot load block "s + blkid.to_str() + " : "));
|
||||
|
@ -478,7 +478,7 @@ bool LiteQuery::request_mc_proof(BlockIdExt blkid, int mode) {
|
|||
++pending_;
|
||||
td::actor::send_closure(
|
||||
manager_, &ValidatorManager::get_key_block_proof, blkid,
|
||||
[Self = actor_id(this), manager = manager_, blkid, mode](td::Result<td::BufferSlice> R) {
|
||||
[ Self = actor_id(this), manager = manager_, blkid, mode ](td::Result<td::BufferSlice> R) {
|
||||
if (R.is_ok()) {
|
||||
auto proof = create_proof(blkid, R.move_as_ok());
|
||||
proof.ensure();
|
||||
|
@ -510,7 +510,7 @@ bool LiteQuery::request_mc_block_state(BlockIdExt blkid) {
|
|||
++pending_;
|
||||
td::actor::send_closure_later(
|
||||
manager_, &ValidatorManager::get_shard_state_from_db_short, blkid,
|
||||
[Self = actor_id(this), blkid](td::Result<Ref<ShardState>> res) {
|
||||
[ Self = actor_id(this), blkid ](td::Result<Ref<ShardState>> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query,
|
||||
res.move_as_error_prefix("cannot load state for "s + blkid.to_str() + " : "));
|
||||
|
@ -541,7 +541,7 @@ bool LiteQuery::request_block_state(BlockIdExt blkid) {
|
|||
++pending_;
|
||||
td::actor::send_closure_later(
|
||||
manager_, &ValidatorManager::get_shard_state_from_db_short, blkid,
|
||||
[Self = actor_id(this), blkid](td::Result<Ref<ShardState>> res) {
|
||||
[ Self = actor_id(this), blkid ](td::Result<Ref<ShardState>> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query,
|
||||
res.move_as_error_prefix("cannot load state for "s + blkid.to_str() + " : "));
|
||||
|
@ -563,7 +563,7 @@ bool LiteQuery::request_block_data(BlockIdExt blkid) {
|
|||
++pending_;
|
||||
td::actor::send_closure_later(
|
||||
manager_, &ValidatorManager::get_block_data_from_db_short, blkid,
|
||||
[Self = actor_id(this), blkid](td::Result<Ref<BlockData>> res) {
|
||||
[ Self = actor_id(this), blkid ](td::Result<Ref<BlockData>> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query,
|
||||
res.move_as_error_prefix("cannot load block "s + blkid.to_str() + " : "));
|
||||
|
@ -586,7 +586,7 @@ bool LiteQuery::request_proof_link(BlockIdExt blkid) {
|
|||
if (blkid.is_masterchain()) {
|
||||
td::actor::send_closure(
|
||||
manager_, &ValidatorManager::get_key_block_proof_link, blkid,
|
||||
[Self = actor_id(this), manager = manager_, blkid](td::Result<td::BufferSlice> R) {
|
||||
[ Self = actor_id(this), manager = manager_, blkid ](td::Result<td::BufferSlice> R) {
|
||||
if (R.is_ok()) {
|
||||
auto proof = create_proof(blkid, R.move_as_ok());
|
||||
proof.ensure();
|
||||
|
@ -608,7 +608,7 @@ bool LiteQuery::request_proof_link(BlockIdExt blkid) {
|
|||
} else {
|
||||
td::actor::send_closure_later(
|
||||
manager_, &ValidatorManager::get_block_proof_link_from_db_short, blkid,
|
||||
[Self = actor_id(this), blkid](td::Result<Ref<ProofLink>> res) {
|
||||
[ Self = actor_id(this), blkid ](td::Result<Ref<ProofLink>> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query,
|
||||
res.move_as_error_prefix("cannot load proof link for "s + blkid.to_str() + " : "));
|
||||
|
@ -634,7 +634,7 @@ bool LiteQuery::request_zero_state(BlockIdExt blkid) {
|
|||
++pending_;
|
||||
td::actor::send_closure_later(
|
||||
manager_, &ValidatorManager::get_zero_state, blkid,
|
||||
[Self = actor_id(this), blkid](td::Result<td::BufferSlice> res) {
|
||||
[ Self = actor_id(this), blkid ](td::Result<td::BufferSlice> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query,
|
||||
res.move_as_error_prefix("cannot load zerostate of "s + blkid.to_str() + " : "));
|
||||
|
@ -679,7 +679,7 @@ void LiteQuery::perform_getAccountState(BlockIdExt blkid, WorkchainId workchain,
|
|||
LOG(INFO) << "sending a get_top_masterchain_state_block query to manager";
|
||||
td::actor::send_closure_later(
|
||||
manager_, &ton::validator::ValidatorManager::get_top_masterchain_state_block,
|
||||
[Self = actor_id(this)](td::Result<std::pair<Ref<ton::validator::MasterchainState>, BlockIdExt>> res) -> void {
|
||||
[Self = actor_id(this)](td::Result<std::pair<Ref<ton::validator::MasterchainState>, BlockIdExt>> res)->void {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query, res.move_as_error());
|
||||
} else {
|
||||
|
@ -890,7 +890,7 @@ bool LiteQuery::make_state_root_proof(Ref<vm::Cell>& proof, Ref<vm::Cell> state_
|
|||
return true;
|
||||
}
|
||||
|
||||
bool LiteQuery::make_shard_info_proof(Ref<vm::Cell>& proof, vm::CellSlice& cs, ShardIdFull shard,
|
||||
bool LiteQuery::make_shard_info_proof(Ref<vm::Cell>& proof, Ref<block::McShardHash>& info, ShardIdFull shard,
|
||||
ShardIdFull& true_shard, Ref<vm::Cell>& leaf, bool& found, bool exact) {
|
||||
vm::MerkleProofBuilder pb{mc_state_->root_cell()};
|
||||
block::gen::ShardStateUnsplit::Record sstate;
|
||||
|
@ -901,7 +901,16 @@ bool LiteQuery::make_shard_info_proof(Ref<vm::Cell>& proof, vm::CellSlice& cs, S
|
|||
if (!shards_dict) {
|
||||
return fatal_error("cannot extract ShardHashes from last mc state");
|
||||
}
|
||||
vm::CellSlice cs;
|
||||
found = block::ShardConfig::get_shard_hash_raw_from(*shards_dict, cs, shard, true_shard, exact, &leaf);
|
||||
if (found) {
|
||||
info = block::McShardHash::unpack(cs, true_shard);
|
||||
if (info.is_null()) {
|
||||
return fatal_error("cannot unpack a leaf entry from ShardHashes");
|
||||
}
|
||||
} else {
|
||||
info.clear();
|
||||
}
|
||||
if (!pb.extract_proof_to(proof)) {
|
||||
return fatal_error("unknown error creating Merkle proof");
|
||||
}
|
||||
|
@ -911,21 +920,9 @@ bool LiteQuery::make_shard_info_proof(Ref<vm::Cell>& proof, vm::CellSlice& cs, S
|
|||
bool LiteQuery::make_shard_info_proof(Ref<vm::Cell>& proof, Ref<block::McShardHash>& info, ShardIdFull shard,
|
||||
bool exact) {
|
||||
Ref<vm::Cell> leaf;
|
||||
vm::CellSlice cs;
|
||||
ShardIdFull true_shard;
|
||||
bool found;
|
||||
if (!make_shard_info_proof(proof, cs, shard, true_shard, leaf, found, exact)) {
|
||||
return false;
|
||||
}
|
||||
if (found) {
|
||||
info = block::McShardHash::unpack(cs, true_shard);
|
||||
if (info.is_null()) {
|
||||
return fatal_error("cannot unpack a leaf entry from ShardHashes");
|
||||
}
|
||||
} else {
|
||||
info.clear();
|
||||
}
|
||||
return true;
|
||||
return make_shard_info_proof(proof, info, shard, true_shard, leaf, found, exact);
|
||||
}
|
||||
|
||||
bool LiteQuery::make_shard_info_proof(Ref<vm::Cell>& proof, Ref<block::McShardHash>& info, AccountIdPrefixFull prefix) {
|
||||
|
@ -1271,14 +1268,14 @@ void LiteQuery::continue_getTransactions(unsigned remaining, bool exact) {
|
|||
<< " " << trans_lt_;
|
||||
td::actor::send_closure_later(
|
||||
manager_, &ValidatorManager::get_block_by_lt_from_db, ton::extract_addr_prefix(acc_workchain_, acc_addr_),
|
||||
trans_lt_, [Self = actor_id(this), remaining, manager = manager_](td::Result<ConstBlockHandle> res) {
|
||||
trans_lt_, [ Self = actor_id(this), remaining, manager = manager_ ](td::Result<ConstBlockHandle> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_getTransactions, res.move_as_error(), ton::BlockIdExt{});
|
||||
} else {
|
||||
auto handle = res.move_as_ok();
|
||||
LOG(DEBUG) << "requesting data for block " << handle->id().to_str();
|
||||
td::actor::send_closure_later(manager, &ValidatorManager::get_block_data_from_db, handle,
|
||||
[Self, blkid = handle->id(), remaining](td::Result<Ref<BlockData>> res) {
|
||||
[ Self, blkid = handle->id(), remaining ](td::Result<Ref<BlockData>> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_getTransactions,
|
||||
res.move_as_error(), blkid);
|
||||
|
@ -1345,7 +1342,7 @@ void LiteQuery::perform_getShardInfo(BlockIdExt blkid, ShardIdFull shard, bool e
|
|||
void LiteQuery::perform_getConfigParams(BlockIdExt blkid, int mode, std::vector<int> param_list) {
|
||||
LOG(INFO) << "started a getConfigParams(" << blkid.to_str() << ", " << mode << ", <list of " << param_list.size()
|
||||
<< " parameters>) liteserver query";
|
||||
set_continuation([this, mode, param_list = std::move(param_list)]() mutable {
|
||||
set_continuation([ this, mode, param_list = std::move(param_list) ]() mutable {
|
||||
continue_getConfigParams(mode, std::move(param_list));
|
||||
});
|
||||
request_mc_block_data_state(blkid);
|
||||
|
@ -1412,7 +1409,8 @@ void LiteQuery::continue_getShardInfo(ShardIdFull shard, bool exact) {
|
|||
vm::CellSlice cs;
|
||||
ShardIdFull true_shard;
|
||||
bool found;
|
||||
if (!make_shard_info_proof(proof2, cs, shard, true_shard, leaf, found, exact)) {
|
||||
Ref<block::McShardHash> shard_info;
|
||||
if (!make_shard_info_proof(proof2, shard_info, shard, true_shard, leaf, found, exact)) {
|
||||
return;
|
||||
}
|
||||
auto proof = vm::std_boc_serialize_multi({std::move(proof1), std::move(proof2)});
|
||||
|
@ -1423,7 +1421,6 @@ void LiteQuery::continue_getShardInfo(ShardIdFull shard, bool exact) {
|
|||
BlockIdExt true_id;
|
||||
td::BufferSlice data;
|
||||
if (found) {
|
||||
auto shard_info = block::McShardHash::unpack(cs, true_shard);
|
||||
if (shard_info.is_null()) {
|
||||
fatal_error("cannot unpack a leaf entry from ShardHashes");
|
||||
return;
|
||||
|
@ -1498,14 +1495,14 @@ void LiteQuery::perform_lookupBlock(BlockId blkid, int mode, LogicalTime lt, Uni
|
|||
LOG(INFO) << "performing a lookupBlock(" << blkid.to_str() << ", " << mode << ", " << lt << ", " << utime
|
||||
<< ") query";
|
||||
auto P = td::PromiseCreator::lambda(
|
||||
[Self = actor_id(this), manager = manager_, mode = (mode >> 4)](td::Result<ConstBlockHandle> res) {
|
||||
[ Self = actor_id(this), manager = manager_, mode = (mode >> 4) ](td::Result<ConstBlockHandle> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query, res.move_as_error());
|
||||
} else {
|
||||
auto handle = res.move_as_ok();
|
||||
LOG(DEBUG) << "requesting data for block " << handle->id().to_str();
|
||||
td::actor::send_closure_later(manager, &ValidatorManager::get_block_data_from_db, handle,
|
||||
[Self, blkid = handle->id(), mode](td::Result<Ref<BlockData>> res) {
|
||||
[ Self, blkid = handle->id(), mode ](td::Result<Ref<BlockData>> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query, res.move_as_error());
|
||||
} else {
|
||||
|
@ -1653,7 +1650,7 @@ void LiteQuery::perform_getBlockProof(ton::BlockIdExt from, ton::BlockIdExt to,
|
|||
if (mode & 0x1000) {
|
||||
BlockIdExt bblk = (from.seqno() > to.seqno()) ? from : to;
|
||||
td::actor::send_closure_later(manager_, &ValidatorManager::get_shard_state_from_db_short, bblk,
|
||||
[Self = actor_id(this), from, to, bblk, mode](td::Result<Ref<ShardState>> res) {
|
||||
[ Self = actor_id(this), from, to, bblk, mode ](td::Result<Ref<ShardState>> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query, res.move_as_error());
|
||||
} else {
|
||||
|
@ -1665,7 +1662,7 @@ void LiteQuery::perform_getBlockProof(ton::BlockIdExt from, ton::BlockIdExt to,
|
|||
} else {
|
||||
td::actor::send_closure_later(
|
||||
manager_, &ton::validator::ValidatorManager::get_top_masterchain_state_block,
|
||||
[Self = actor_id(this), from, to, mode](td::Result<std::pair<Ref<MasterchainState>, BlockIdExt>> res) {
|
||||
[ Self = actor_id(this), from, to, mode ](td::Result<std::pair<Ref<MasterchainState>, BlockIdExt>> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query, res.move_as_error());
|
||||
} else {
|
||||
|
@ -1678,7 +1675,7 @@ void LiteQuery::perform_getBlockProof(ton::BlockIdExt from, ton::BlockIdExt to,
|
|||
} else if (mode & 2) {
|
||||
td::actor::send_closure_later(
|
||||
manager_, &ton::validator::ValidatorManager::get_top_masterchain_state_block,
|
||||
[Self = actor_id(this), from, mode](td::Result<std::pair<Ref<MasterchainState>, BlockIdExt>> res) {
|
||||
[ Self = actor_id(this), from, mode ](td::Result<std::pair<Ref<MasterchainState>, BlockIdExt>> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query, res.move_as_error());
|
||||
} else {
|
||||
|
@ -1689,7 +1686,7 @@ void LiteQuery::perform_getBlockProof(ton::BlockIdExt from, ton::BlockIdExt to,
|
|||
});
|
||||
} else {
|
||||
td::actor::send_closure_later(manager_, &ton::validator::ValidatorManager::get_shard_client_state, false,
|
||||
[Self = actor_id(this), from, mode](td::Result<BlockIdExt> res) {
|
||||
[ Self = actor_id(this), from, mode ](td::Result<BlockIdExt> res) {
|
||||
if (res.is_error()) {
|
||||
td::actor::send_closure(Self, &LiteQuery::abort_query, res.move_as_error());
|
||||
} else {
|
||||
|
|
|
@ -160,7 +160,7 @@ class LiteQuery : public td::actor::Actor {
|
|||
const BlockIdExt& blkid);
|
||||
bool make_state_root_proof(Ref<vm::Cell>& proof, Ref<vm::Cell> state_root, Ref<vm::Cell> block_root,
|
||||
const BlockIdExt& blkid);
|
||||
bool make_shard_info_proof(Ref<vm::Cell>& proof, vm::CellSlice& cs, ShardIdFull shard, ShardIdFull& true_shard,
|
||||
bool make_shard_info_proof(Ref<vm::Cell>& proof, Ref<block::McShardHash>& info, ShardIdFull shard, ShardIdFull& true_shard,
|
||||
Ref<vm::Cell>& leaf, bool& found, bool exact = true);
|
||||
bool make_shard_info_proof(Ref<vm::Cell>& proof, Ref<block::McShardHash>& info, ShardIdFull shard, bool exact = true);
|
||||
bool make_shard_info_proof(Ref<vm::Cell>& proof, Ref<block::McShardHash>& info, AccountIdPrefixFull prefix);
|
||||
|
|
|
@ -1210,7 +1210,7 @@ bool ValidateQuery::request_neighbor_queues() {
|
|||
}
|
||||
int i = 0;
|
||||
for (block::McShardDescr& descr : neighbors_) {
|
||||
LOG(DEBUG) << "neighbor #" << i << " : " << descr.blk_.to_str();
|
||||
LOG(DEBUG) << "requesting outbound queue of neighbor #" << i << " : " << descr.blk_.to_str();
|
||||
++pending;
|
||||
send_closure_later(manager, &ValidatorManager::wait_block_message_queue_short, descr.blk_, priority(), timeout,
|
||||
[ self = get_self(), i ](td::Result<Ref<MessageQueue>> res) {
|
||||
|
@ -3974,12 +3974,14 @@ bool ValidateQuery::check_delivered_dequeued() {
|
|||
// could look up neighbor with shard containing enq_msg_descr.next_prefix more efficiently
|
||||
// (instead of checking all neighbors)
|
||||
if (!nb.is_disabled() && nb.processed_upto->already_processed(enq)) {
|
||||
// the message has been delivered!
|
||||
return reject_query(
|
||||
PSTRING()
|
||||
<< "outbound message with (lt,hash)=(" << enq.lt_ << "," << enq.hash_.to_hex() << ") enqueued_lt="
|
||||
<< enq.enqueued_lt_ << " has been already delivered and processed by neighbor " << nb.blk_.to_str()
|
||||
<< " but it has not been dequeued in this block and it is still present in the new outbound queue");
|
||||
// the message has been delivered but not removed from queue!
|
||||
LOG(WARNING) << "outbound queue not cleaned up completely (overfull block?): outbound message with (lt,hash)=("
|
||||
<< enq.lt_ << "," << enq.hash_.to_hex() << ") enqueued_lt=" << enq.enqueued_lt_
|
||||
<< " has been already delivered and processed by neighbor " << nb.blk_.to_str()
|
||||
<< " but it has not been dequeued in this block and it is still present in the new outbound queue";
|
||||
outq_cleanup_partial_ = true;
|
||||
ok = true;
|
||||
return false; // skip scanning the remainder of the queue
|
||||
}
|
||||
}
|
||||
if (created_lt >= start_lt_) {
|
||||
|
|
|
@ -144,6 +144,7 @@ class ValidateQuery : public td::actor::Actor {
|
|||
bool is_fake_{false};
|
||||
bool prev_key_block_exists_{false};
|
||||
bool debug_checks_{false};
|
||||
bool outq_cleanup_partial_{false};
|
||||
BlockSeqno prev_key_seqno_{~0u};
|
||||
int stage_{0};
|
||||
td::BitArray<64> shard_pfx_;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with TON Blockchain Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2017-2019 Telegram Systems LLP
|
||||
Copyright 2017-2020 Telegram Systems LLP
|
||||
*/
|
||||
#include "validator-set.hpp"
|
||||
#include "auto/tl/ton_api.h"
|
||||
|
@ -156,6 +156,8 @@ Ref<ValidatorSet> ValidatorSetCompute::compute_validator_set(ShardIdFull shard,
|
|||
LOG(DEBUG) << "in compute_validator_set() for " << shard.to_str();
|
||||
auto nodes = config_->compute_validator_set(shard, vset, time, ccseqno);
|
||||
if (nodes.empty()) {
|
||||
LOG(ERROR) << "compute_validator_set() for " << shard.to_str() << "," << time << "," << ccseqno
|
||||
<< " returned empty list";
|
||||
return {};
|
||||
}
|
||||
return Ref<ValidatorSetQ>{true, ccseqno, shard, std::move(nodes)};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue