mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
optimistic out-msg-queue broadcast
This commit is contained in:
parent
6df6f182bf
commit
bf572f9599
24 changed files with 623 additions and 126 deletions
|
@ -46,6 +46,33 @@ void FullNodeFastSyncOverlay::process_block_broadcast(PublicKeyHash src, ton_api
|
|||
td::actor::send_closure(full_node_, &FullNode::process_block_broadcast, B.move_as_ok());
|
||||
}
|
||||
|
||||
void FullNodeFastSyncOverlay::process_broadcast(PublicKeyHash src, ton_api::tonNode_outMsgQueueProofBroadcast &query) {
|
||||
BlockIdExt block_id = create_block_id(query.block_);
|
||||
ShardIdFull shard_id = create_shard_id(query.dst_shard_);
|
||||
if (query.proof_->get_id() != ton_api::tonNode_outMsgQueueProof::ID) {
|
||||
LOG(ERROR) << "got tonNode.outMsgQueueProofBroadcast with proof not tonNode.outMsgQueueProof";
|
||||
return;
|
||||
}
|
||||
auto tl_proof = move_tl_object_as<ton_api::tonNode_outMsgQueueProof>(query.proof_);
|
||||
auto R = OutMsgQueueProof::fetch(shard_id, {block_id},
|
||||
block::ImportedMsgQueueLimits{.max_bytes = td::uint32(query.limits_->max_bytes_),
|
||||
.max_msgs = td::uint32(query.limits_->max_msgs_)},
|
||||
*tl_proof);
|
||||
if (R.is_error()) {
|
||||
LOG(ERROR) << "got tonNode.outMsgQueueProofBroadcast with invalid proof: " << R.error();
|
||||
return;
|
||||
}
|
||||
if (R.ok().size() != 1) {
|
||||
LOG(ERROR) << "got tonNode.outMsgQueueProofBroadcast with invalid proofs count=" << R.ok().size();
|
||||
return;
|
||||
}
|
||||
auto proof = std::move(R.move_as_ok()[0]);
|
||||
|
||||
LOG(INFO) << "got tonNode.outMsgQueueProofBroadcast " << shard_id.to_str() << " " << block_id.to_str();
|
||||
td::actor::send_closure(validator_manager_, &ValidatorManagerInterface::add_out_msg_queue_proof, shard_id,
|
||||
std::move(proof));
|
||||
}
|
||||
|
||||
void FullNodeFastSyncOverlay::process_broadcast(PublicKeyHash src, ton_api::tonNode_newShardBlockBroadcast &query) {
|
||||
BlockIdExt block_id = create_block_id(query.block_->block_);
|
||||
VLOG(FULL_NODE_DEBUG) << "Received newShardBlockBroadcast in fast sync overlay from " << src << ": "
|
||||
|
@ -200,6 +227,22 @@ void FullNodeFastSyncOverlay::collect_validator_telemetry(std::string filename)
|
|||
}
|
||||
}
|
||||
|
||||
void FullNodeFastSyncOverlay::send_out_msg_queue_proof_broadcast(td::Ref<OutMsgQueueProofBroadcast> broadcast) {
|
||||
if (!inited_) {
|
||||
return;
|
||||
}
|
||||
auto B = create_serialize_tl_object<ton_api::tonNode_outMsgQueueProofBroadcast>(
|
||||
create_tl_shard_id(broadcast->dst_shard), create_tl_block_id(broadcast->block_id),
|
||||
create_tl_object<ton_api::tonNode_importedMsgQueueLimits>(broadcast->max_bytes, broadcast->max_msgs),
|
||||
create_tl_object<ton_api::tonNode_outMsgQueueProof>(broadcast->queue_proofs.clone(),
|
||||
broadcast->block_state_proofs.clone(),
|
||||
std::vector<std::int32_t>(broadcast->msg_counts)));
|
||||
VLOG(FULL_NODE_DEBUG) << "Sending outMsgQueueProof in fast sync overlay: " << broadcast->dst_shard.to_str() << " "
|
||||
<< broadcast->block_id.to_str();
|
||||
td::actor::send_closure(overlays_, &overlay::Overlays::send_broadcast_fec_ex, local_id_, overlay_id_,
|
||||
local_id_.pubkey_hash(), overlay::Overlays::BroadcastFlagAnySender(), std::move(B));
|
||||
}
|
||||
|
||||
void FullNodeFastSyncOverlay::start_up() {
|
||||
auto X = create_hash_tl_object<ton_api::tonNode_fastSyncOverlayId>(zero_state_file_hash_, create_tl_shard_id(shard_));
|
||||
td::BufferSlice b{32};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue