mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Rework limiting imported msg queues
This commit is contained in:
parent
e6b77ef71d
commit
869c6fe675
9 changed files with 30 additions and 51 deletions
|
@ -526,14 +526,6 @@ bool ValidateQuery::extract_collated_data_from(Ref<vm::Cell> croot, int idx) {
|
|||
top_shard_descr_dict_ = std::make_unique<vm::Dictionary>(cs.prefetch_ref(), 96);
|
||||
return true;
|
||||
}
|
||||
if (block::gen::t_NeighborMsgQueueLimits.has_valid_tag(cs)) {
|
||||
LOG(DEBUG) << "collated datum # " << idx << " is a NeighborMsgQueueLimits";
|
||||
if (!block::gen::t_NeighborMsgQueueLimits.validate_upto(10000, cs)) {
|
||||
return reject_query("invalid NeighborMsgQueueLimits");
|
||||
}
|
||||
neighbor_msg_queues_limits_ = vm::Dictionary{cs.prefetch_ref(0), 32 + 64};
|
||||
return true;
|
||||
}
|
||||
LOG(WARNING) << "collated datum # " << idx << " has unknown type (magic " << cs.prefetch_ulong(32) << "), ignoring";
|
||||
return true;
|
||||
}
|
||||
|
@ -4115,19 +4107,7 @@ bool ValidateQuery::check_in_queue() {
|
|||
td::BitArray<96> key;
|
||||
key.bits().store_int(descr.workchain(), 32);
|
||||
(key.bits() + 32).store_uint(descr.shard().shard, 64);
|
||||
auto r = neighbor_msg_queues_limits_.lookup(key);
|
||||
td::int32 msg_limit = r.is_null() ? -1 : (td::int32)r->prefetch_long(32);
|
||||
if (msg_limit < -1) {
|
||||
return reject_query("invalid value in NeighborMsgQueueLimits");
|
||||
}
|
||||
LOG(DEBUG) << "Neighbor " << descr.shard().to_str() << " has msg_limit=" << msg_limit;
|
||||
neighbor_queues.emplace_back(descr.top_block_id(), descr.outmsg_root, descr.disabled_, msg_limit);
|
||||
if (msg_limit != -1 && descr.shard().is_masterchain()) {
|
||||
return reject_query("masterchain out message queue cannot be limited");
|
||||
}
|
||||
if (msg_limit != -1 && shard_intersects(descr.shard(), shard_)) {
|
||||
return reject_query("prev block out message queue cannot be limited");
|
||||
}
|
||||
neighbor_queues.emplace_back(descr.top_block_id(), descr.outmsg_root, descr.disabled_);
|
||||
}
|
||||
block::OutputQueueMerger nb_out_msgs(shard_, std::move(neighbor_queues));
|
||||
while (!nb_out_msgs.is_eof()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue