diff --git a/validator/impl/collator.cpp b/validator/impl/collator.cpp index 98f0799c..5d0d2972 100644 --- a/validator/impl/collator.cpp +++ b/validator/impl/collator.cpp @@ -500,14 +500,15 @@ void Collator::after_get_block_data(int idx, td::Result> res) { CHECK(!idx); prev_mc_block = prev_block_data[0]; mc_block_root = prev_mc_block->root_cell(); + } else { + Ref root = prev_block_data[idx]->root_cell(); + auto proof = create_block_state_proof(root); + if (proof.is_error()) { + fatal_error(proof.move_as_error()); + return; + } + block_state_proofs_.emplace(root->get_hash().bits(), proof.move_as_ok()); } - Ref root = prev_block_data[idx]->root_cell(); - auto proof = create_block_state_proof(root); - if (proof.is_error()) { - fatal_error(proof.move_as_error()); - return; - } - block_state_proofs_.emplace(root->get_hash().bits(), proof.move_as_ok()); } check_pending(); } @@ -622,7 +623,6 @@ bool Collator::request_neighbor_msg_queues() { neighbors_.emplace_back(*shard_ptr); } unsigned i = 0; - neighbor_proof_builders_.resize(neighbors_.size()); for (block::McShardDescr& descr : neighbors_) { LOG(DEBUG) << "neighbor #" << i << " : " << descr.blk_.to_str(); ++pending; @@ -644,11 +644,17 @@ void Collator::got_neighbor_msg_queue(unsigned i, td::Resultblock_state_proof_.not_null()) { + if (res->block_state_proof_.not_null() && !block_id.is_masterchain()) { block_state_proofs_.emplace(block_id.root_hash, res->block_state_proof_); } - neighbor_proof_builders_.at(i) = vm::MerkleProofBuilder{res->state_root_}; - auto state = ShardStateQ::fetch(block_id, {}, neighbor_proof_builders_.at(i).root()); + Ref state_root; + if (block_id.is_masterchain()) { + state_root = res->state_root_; + } else { + neighbor_proof_builders_.push_back(vm::MerkleProofBuilder{res->state_root_}); + state_root = neighbor_proof_builders_.back().root(); + } + auto state = ShardStateQ::fetch(block_id, {}, state_root); if (state.is_error()) { fatal_error(state.move_as_error()); return; diff --git a/validator/impl/validate-query.cpp b/validator/impl/validate-query.cpp index aa342fc4..f8a2708d 100644 --- a/validator/impl/validate-query.cpp +++ b/validator/impl/validate-query.cpp @@ -1258,6 +1258,15 @@ bool ValidateQuery::request_neighbor_queues() { if (full_collated_data_) { for (block::McShardDescr& descr : neighbors_) { LOG(DEBUG) << "getting outbound queue of neighbor #" << i << " from collated data : " << descr.blk_.to_str(); + if (descr.blk_.is_masterchain()) { + if (descr.blk_ != mc_state_->get_block_id()) { + return fatal_error("neighbor from masterchain is not the last mc block"); + } + ++pending; + send_closure_later(get_self(), &ValidateQuery::got_neighbor_out_queue, i, mc_state_->message_queue()); + ++i; + continue; + } td::Bits256 state_root_hash; if (descr.blk_.seqno() == 0) { state_root_hash = descr.blk_.root_hash;