mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Merge message dispatch queue (#1030)
* Deferred messages and msg metadata * Store out msg queue size in state * Add checks for queue processing 1. Collator must process at least one message from AccountDispatchQueue (unless block is full) 2. The first message from a transaction is not counted, it cannot be deferred (unless AccountDispatchQueue is not empty) * Return msg metadata from LS in listBlockTransactions[Ext] * Enable new features by capabilities * Changes in deferred messages * Process deferred messages via new_msgs in collator * Rework setting deferred_lt, bring back check_message_processing_order, check order of deferred_lt in validator * Use have_unprocessed_account_dispatch_queue_ in collator * Fix setting transaction lt for deferred messages * Fix lite-client compilation error * Changes in process_dispatch_queue, rename deferred_lt -> emitted_lt * Fix compilation error * Use uint64 for msg queue size * Add liteServer.getBlockOutMsgQueueSize * Fix compilation error * Fix typos in comments --------- Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
38fc1d5456
commit
0daee1d887
29 changed files with 1889 additions and 318 deletions
|
@ -417,6 +417,8 @@ struct ShardState {
|
|||
std::unique_ptr<vm::Dictionary> ihr_pending_;
|
||||
std::unique_ptr<vm::Dictionary> block_create_stats_;
|
||||
std::shared_ptr<block::MsgProcessedUptoCollection> processed_upto_;
|
||||
std::unique_ptr<vm::AugmentedDictionary> dispatch_queue_;
|
||||
td::optional<td::uint64> out_msg_queue_size_;
|
||||
|
||||
bool is_valid() const {
|
||||
return id_.is_valid();
|
||||
|
@ -433,11 +435,10 @@ struct ShardState {
|
|||
ton::BlockSeqno prev_mc_block_seqno, bool after_split, bool clear_history,
|
||||
std::function<bool(ton::BlockSeqno)> for_each_mcseqno);
|
||||
td::Status merge_with(ShardState& sib);
|
||||
td::Result<std::unique_ptr<vm::AugmentedDictionary>> compute_split_out_msg_queue(ton::ShardIdFull subshard,
|
||||
td::uint32* queue_size = nullptr);
|
||||
td::Result<std::unique_ptr<vm::AugmentedDictionary>> compute_split_out_msg_queue(ton::ShardIdFull subshard);
|
||||
td::Result<std::shared_ptr<block::MsgProcessedUptoCollection>> compute_split_processed_upto(
|
||||
ton::ShardIdFull subshard);
|
||||
td::Status split(ton::ShardIdFull subshard, td::uint32* queue_size = nullptr);
|
||||
td::Status split(ton::ShardIdFull subshard);
|
||||
td::Status unpack_out_msg_queue_info(Ref<vm::Cell> out_msg_queue_info);
|
||||
bool clear_load_history() {
|
||||
overload_history_ = underload_history_ = 0;
|
||||
|
@ -658,7 +659,7 @@ class MtCarloComputeShare {
|
|||
};
|
||||
|
||||
int filter_out_msg_queue(vm::AugmentedDictionary& out_queue, ton::ShardIdFull old_shard, ton::ShardIdFull subshard,
|
||||
td::uint32* queue_size = nullptr);
|
||||
td::uint64* queue_size = nullptr);
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const ShardId& shard_id);
|
||||
|
||||
|
@ -749,4 +750,25 @@ bool parse_hex_hash(td::Slice str, td::Bits256& hash);
|
|||
bool parse_block_id_ext(const char* str, const char* end, ton::BlockIdExt& blkid);
|
||||
bool parse_block_id_ext(td::Slice str, ton::BlockIdExt& blkid);
|
||||
|
||||
bool unpack_account_dispatch_queue(Ref<vm::CellSlice> csr, vm::Dictionary& dict, td::uint64& dict_size);
|
||||
Ref<vm::CellSlice> pack_account_dispatch_queue(const vm::Dictionary& dict, td::uint64 dict_size);
|
||||
Ref<vm::CellSlice> get_dispatch_queue_min_lt_account(const vm::AugmentedDictionary& dispatch_queue,
|
||||
ton::StdSmcAddress& addr);
|
||||
bool remove_dispatch_queue_entry(vm::AugmentedDictionary& dispatch_queue, const ton::StdSmcAddress& addr,
|
||||
ton::LogicalTime lt);
|
||||
|
||||
struct MsgMetadata {
|
||||
td::uint32 depth;
|
||||
ton::WorkchainId initiator_wc;
|
||||
ton::StdSmcAddress initiator_addr;
|
||||
ton::LogicalTime initiator_lt;
|
||||
|
||||
bool unpack(vm::CellSlice& cs);
|
||||
bool pack(vm::CellBuilder& cb) const;
|
||||
std::string to_str() const;
|
||||
|
||||
bool operator==(const MsgMetadata& other) const;
|
||||
bool operator!=(const MsgMetadata& other) const;
|
||||
};
|
||||
|
||||
} // namespace block
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue