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
|
@ -28,6 +28,7 @@
|
|||
#include "td/utils/bits.h"
|
||||
#include "td/utils/StringBuilder.h"
|
||||
#include "ton/ton-types.h"
|
||||
#include "block-auto.h"
|
||||
|
||||
namespace block {
|
||||
|
||||
|
@ -469,11 +470,17 @@ struct MsgEnvelope final : TLB_Complex {
|
|||
int cur_addr, next_addr;
|
||||
td::RefInt256 fwd_fee_remaining;
|
||||
Ref<vm::Cell> msg;
|
||||
td::optional<ton::LogicalTime> emitted_lt;
|
||||
td::optional<MsgMetadata> metadata;
|
||||
};
|
||||
bool unpack(vm::CellSlice& cs, Record& data) const;
|
||||
bool unpack(vm::CellSlice& cs, Record_std& data) const;
|
||||
bool unpack_std(vm::CellSlice& cs, int& cur_a, int& nhop_a, Ref<vm::Cell>& msg) const;
|
||||
bool get_created_lt(const vm::CellSlice& cs, unsigned long long& created_lt) const;
|
||||
bool pack(vm::CellBuilder& cb, const Record_std& data) const;
|
||||
bool pack_cell(td::Ref<vm::Cell>& cell, const Record_std& data) const;
|
||||
bool get_emitted_lt(const vm::CellSlice& cs, unsigned long long& emitted_lt) const;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
return (int)cs.prefetch_ulong(4);
|
||||
}
|
||||
};
|
||||
|
||||
extern const MsgEnvelope t_MsgEnvelope;
|
||||
|
@ -801,12 +808,18 @@ struct InMsg final : TLB_Complex {
|
|||
msg_import_fin = 4,
|
||||
msg_import_tr = 5,
|
||||
msg_discard_fin = 6,
|
||||
msg_discard_tr = 7
|
||||
msg_discard_tr = 7,
|
||||
msg_import_deferred_fin = 8,
|
||||
msg_import_deferred_tr = 9
|
||||
};
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
return (int)cs.prefetch_ulong(3);
|
||||
int tag = (int)cs.prefetch_ulong(3);
|
||||
if (tag != 1) {
|
||||
return tag;
|
||||
}
|
||||
return (int)cs.prefetch_ulong(5) - 0b00100 + 8;
|
||||
}
|
||||
bool get_import_fees(vm::CellBuilder& cb, vm::CellSlice& cs) const;
|
||||
};
|
||||
|
@ -822,16 +835,24 @@ struct OutMsg final : TLB_Complex {
|
|||
msg_export_deq_imm = 4,
|
||||
msg_export_deq = 12,
|
||||
msg_export_deq_short = 13,
|
||||
msg_export_tr_req = 7
|
||||
msg_export_tr_req = 7,
|
||||
msg_export_new_defer = 20, // 0b10100
|
||||
msg_export_deferred_tr = 21 // 0b10101
|
||||
};
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
int t = (int)cs.prefetch_ulong(3);
|
||||
return t != 6 ? t : (int)cs.prefetch_ulong(4);
|
||||
if (t == 6) {
|
||||
return (int)cs.prefetch_ulong(4);
|
||||
}
|
||||
if (t == 5) {
|
||||
return (int)cs.prefetch_ulong(5);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
bool get_export_value(vm::CellBuilder& cb, vm::CellSlice& cs) const;
|
||||
bool get_created_lt(vm::CellSlice& cs, unsigned long long& created_lt) const;
|
||||
bool get_emitted_lt(vm::CellSlice& cs, unsigned long long& emitted_lt) const;
|
||||
};
|
||||
|
||||
extern const OutMsg t_OutMsg;
|
||||
|
@ -909,6 +930,16 @@ struct Aug_OutMsgQueue final : AugmentationCheckData {
|
|||
|
||||
extern const Aug_OutMsgQueue aug_OutMsgQueue;
|
||||
|
||||
struct Aug_DispatchQueue final : AugmentationCheckData {
|
||||
Aug_DispatchQueue() : AugmentationCheckData(gen::t_AccountDispatchQueue, t_uint64) {
|
||||
}
|
||||
bool eval_fork(vm::CellBuilder& cb, vm::CellSlice& left_cs, vm::CellSlice& right_cs) const override;
|
||||
bool eval_empty(vm::CellBuilder& cb) const override;
|
||||
bool eval_leaf(vm::CellBuilder& cb, vm::CellSlice& cs) const override;
|
||||
};
|
||||
|
||||
extern const Aug_DispatchQueue aug_DispatchQueue;
|
||||
|
||||
struct OutMsgQueue final : TLB_Complex {
|
||||
HashmapAugE dict_type;
|
||||
OutMsgQueue() : dict_type(32 + 64 + 256, aug_OutMsgQueue){};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue