1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Optimize importing out queues

This commit is contained in:
SpyCheese 2023-07-31 18:12:09 +03:00
parent 44ba040934
commit 5c02459fd8
22 changed files with 588 additions and 450 deletions

View file

@ -26,22 +26,31 @@ namespace validator {
using td::Ref;
struct OutMsgQueueProof : public td::CntObject {
OutMsgQueueProof(Ref<vm::Cell> state_root, Ref<vm::Cell> block_state_proof, td::int32 msg_count = -1)
: state_root_(std::move(state_root)), block_state_proof_(std::move(block_state_proof)), msg_count_(msg_count) {
OutMsgQueueProof(BlockIdExt block_id, Ref<vm::Cell> state_root, Ref<vm::Cell> block_state_proof,
td::int32 msg_count = -1)
: block_id_(block_id)
, state_root_(std::move(state_root))
, block_state_proof_(std::move(block_state_proof))
, msg_count_(msg_count) {
}
BlockIdExt block_id_;
Ref<vm::Cell> state_root_;
Ref<vm::Cell> block_state_proof_;
td::int32 msg_count_; // -1 - up to end of queue
td::int32 msg_count_; // -1 - no limit
static td::Result<td::Ref<OutMsgQueueProof>> fetch(BlockIdExt block_id, ShardIdFull dst_shard,
block::ImportedMsgQueueLimits limits,
const ton_api::tonNode_outMsgQueueProof &f);
static td::Result<tl_object_ptr<ton_api::tonNode_outMsgQueueProof>> build(BlockIdExt block_id, ShardIdFull dst_shard,
block::ImportedMsgQueueLimits limits,
Ref<vm::Cell> state_root,
Ref<vm::Cell> block_root);
static td::Result<std::vector<td::Ref<OutMsgQueueProof>>> fetch(ShardIdFull dst_shard, std::vector<BlockIdExt> blocks,
block::ImportedMsgQueueLimits limits,
const ton_api::tonNode_outMsgQueueProof &f);
struct OneBlock {
BlockIdExt id;
Ref<vm::Cell> state_root;
Ref<vm::Cell> block_root;
};
static td::Result<tl_object_ptr<ton_api::tonNode_outMsgQueueProof>> build(ShardIdFull dst_shard,
std::vector<OneBlock> blocks,
block::ImportedMsgQueueLimits limits);
};
} // namespace validator

View file

@ -129,9 +129,9 @@ class ValidatorManager : public ValidatorManagerInterface {
virtual void send_ihr_message(td::Ref<IhrMessage> message) = 0;
virtual void send_top_shard_block_description(td::Ref<ShardTopBlockDescription> desc) = 0;
virtual void send_block_broadcast(BlockBroadcast broadcast) = 0;
virtual void send_get_out_msg_queue_proof_request(BlockIdExt id, ShardIdFull dst_shard,
block::ImportedMsgQueueLimits limits, td::uint32 priority,
td::Promise<td::Ref<OutMsgQueueProof>> promise) = 0;
virtual void send_get_out_msg_queue_proof_request(ShardIdFull dst_shard, std::vector<BlockIdExt> blocks,
block::ImportedMsgQueueLimits limits,
td::Promise<std::vector<td::Ref<OutMsgQueueProof>>> promise) = 0;
virtual void update_shard_client_state(BlockIdExt masterchain_block_id, td::Promise<td::Unit> promise) = 0;
virtual void get_shard_client_state(bool from_db, td::Promise<BlockIdExt> promise) = 0;