mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Merge branch 'safe_features' into testnet-update
This commit is contained in:
commit
feff73c4be
41 changed files with 1066 additions and 207 deletions
|
@ -3064,7 +3064,7 @@ int Collator::process_one_new_message(block::NewOutMsg msg, bool enqueue_only, R
|
|||
bool defer = false;
|
||||
if (!from_dispatch_queue) {
|
||||
if (deferring_messages_enabled_ && collator_opts_->deferring_enabled && !is_special && !is_special_account &&
|
||||
msg.msg_idx != 0) {
|
||||
!collator_opts_->whitelist.count({src_wc, src_addr}) && msg.msg_idx != 0) {
|
||||
if (++sender_generated_messages_count_[src_addr] >= collator_opts_->defer_messages_after ||
|
||||
out_msg_queue_size_ > defer_out_queue_size_limit_) {
|
||||
defer = true;
|
||||
|
@ -3695,6 +3695,8 @@ bool Collator::process_dispatch_queue() {
|
|||
vm::AugmentedDictionary cur_dispatch_queue{dispatch_queue_->get_root(), 256, block::tlb::aug_DispatchQueue};
|
||||
std::map<std::tuple<WorkchainId, StdSmcAddress, LogicalTime>, size_t> count_per_initiator;
|
||||
size_t total_count = 0;
|
||||
auto prioritylist = collator_opts_->prioritylist;
|
||||
auto prioritylist_iter = prioritylist.begin();
|
||||
while (!cur_dispatch_queue.is_empty()) {
|
||||
block_full_ = !block_limit_status_->fits(block::ParamLimits::cl_normal);
|
||||
if (block_full_) {
|
||||
|
@ -3711,9 +3713,30 @@ bool Collator::process_dispatch_queue() {
|
|||
return true;
|
||||
}
|
||||
StdSmcAddress src_addr;
|
||||
auto account_dispatch_queue = block::get_dispatch_queue_min_lt_account(cur_dispatch_queue, src_addr);
|
||||
td::Ref<vm::CellSlice> account_dispatch_queue;
|
||||
while (!prioritylist.empty()) {
|
||||
if (prioritylist_iter == prioritylist.end()) {
|
||||
prioritylist_iter = prioritylist.begin();
|
||||
}
|
||||
auto priority_addr = *prioritylist_iter;
|
||||
if (priority_addr.first != workchain() || !is_our_address(priority_addr.second)) {
|
||||
prioritylist_iter = prioritylist.erase(prioritylist_iter);
|
||||
continue;
|
||||
}
|
||||
src_addr = priority_addr.second;
|
||||
account_dispatch_queue = cur_dispatch_queue.lookup(src_addr);
|
||||
if (account_dispatch_queue.is_null()) {
|
||||
prioritylist_iter = prioritylist.erase(prioritylist_iter);
|
||||
} else {
|
||||
++prioritylist_iter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (account_dispatch_queue.is_null()) {
|
||||
return fatal_error("invalid dispatch queue in shard state");
|
||||
account_dispatch_queue = block::get_dispatch_queue_min_lt_account(cur_dispatch_queue, src_addr);
|
||||
if (account_dispatch_queue.is_null()) {
|
||||
return fatal_error("invalid dispatch queue in shard state");
|
||||
}
|
||||
}
|
||||
vm::Dictionary dict{64};
|
||||
td::uint64 dict_size;
|
||||
|
@ -3733,7 +3756,8 @@ bool Collator::process_dispatch_queue() {
|
|||
// Remove message from DispatchQueue
|
||||
bool ok;
|
||||
if (iter == 0 ||
|
||||
(iter == 1 && sender_generated_messages_count_[src_addr] >= collator_opts_->defer_messages_after)) {
|
||||
(iter == 1 && sender_generated_messages_count_[src_addr] >= collator_opts_->defer_messages_after &&
|
||||
!collator_opts_->whitelist.count({workchain(), src_addr}))) {
|
||||
ok = cur_dispatch_queue.lookup_delete(src_addr).not_null();
|
||||
} else {
|
||||
dict.lookup_delete(key);
|
||||
|
|
|
@ -870,7 +870,7 @@ void LiteQuery::perform_runSmcMethod(BlockIdExt blkid, WorkchainId workchain, St
|
|||
vm::FakeVmStateLimits fstate(1000); // limit recursive (de)serialization calls
|
||||
vm::VmStateInterface::Guard guard(&fstate);
|
||||
auto cs = vm::load_cell_slice(res.move_as_ok());
|
||||
if (!(vm::Stack::deserialize_to(cs, stack_, 0) && cs.empty_ext())) {
|
||||
if (!(vm::Stack::deserialize_to(cs, stack_, 2 /* no continuations */) && cs.empty_ext())) {
|
||||
fatal_error("parameter list boc cannot be deserialized as a VmStack");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ ShardStateQ::ShardStateQ(const ShardStateQ& other)
|
|||
, root(other.root)
|
||||
, lt(other.lt)
|
||||
, utime(other.utime)
|
||||
, global_id_(other.global_id_)
|
||||
, before_split_(other.before_split_)
|
||||
, fake_split_(other.fake_split_)
|
||||
, fake_merge_(other.fake_merge_) {
|
||||
|
@ -121,6 +122,7 @@ td::Status ShardStateQ::init() {
|
|||
}
|
||||
lt = info.gen_lt;
|
||||
utime = info.gen_utime;
|
||||
global_id_ = info.global_id;
|
||||
before_split_ = info.before_split;
|
||||
block::ShardId id{info.shard_id};
|
||||
ton::BlockId hdr_id{ton::ShardIdFull(id), info.seq_no};
|
||||
|
|
|
@ -38,6 +38,7 @@ class ShardStateQ : virtual public ShardState {
|
|||
Ref<vm::Cell> root;
|
||||
LogicalTime lt{0};
|
||||
UnixTime utime{0};
|
||||
td::int32 global_id_{0};
|
||||
bool before_split_{false};
|
||||
bool fake_split_{false};
|
||||
bool fake_merge_{false};
|
||||
|
@ -81,6 +82,9 @@ class ShardStateQ : virtual public ShardState {
|
|||
LogicalTime get_logical_time() const override {
|
||||
return lt;
|
||||
}
|
||||
td::int32 get_global_id() const override {
|
||||
return global_id_;
|
||||
}
|
||||
td::optional<BlockIdExt> get_master_ref() const override {
|
||||
return master_ref;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue