mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Add more required cells to the proof in collated data
This commit is contained in:
parent
5ce9d0bcdb
commit
e8e7883329
3 changed files with 36 additions and 5 deletions
|
@ -224,7 +224,7 @@ class Collator final : public td::actor::Actor {
|
||||||
|
|
||||||
std::unique_ptr<ton::BlockCandidate> block_candidate;
|
std::unique_ptr<ton::BlockCandidate> block_candidate;
|
||||||
|
|
||||||
std::unique_ptr<vm::AugmentedDictionary> dispatch_queue_;
|
std::unique_ptr<vm::AugmentedDictionary> dispatch_queue_, old_dispatch_queue_;
|
||||||
std::map<StdSmcAddress, td::uint32> sender_generated_messages_count_;
|
std::map<StdSmcAddress, td::uint32> sender_generated_messages_count_;
|
||||||
unsigned dispatch_queue_ops_{0};
|
unsigned dispatch_queue_ops_{0};
|
||||||
std::map<StdSmcAddress, LogicalTime> last_dispatch_queue_emitted_lt_;
|
std::map<StdSmcAddress, LogicalTime> last_dispatch_queue_emitted_lt_;
|
||||||
|
|
|
@ -1215,6 +1215,7 @@ bool Collator::import_shard_state_data(block::ShardState& ss) {
|
||||||
processed_upto_ = std::move(ss.processed_upto_);
|
processed_upto_ = std::move(ss.processed_upto_);
|
||||||
ihr_pending = std::move(ss.ihr_pending_);
|
ihr_pending = std::move(ss.ihr_pending_);
|
||||||
dispatch_queue_ = std::move(ss.dispatch_queue_);
|
dispatch_queue_ = std::move(ss.dispatch_queue_);
|
||||||
|
old_dispatch_queue_ = std::make_unique<vm::AugmentedDictionary>(*dispatch_queue_);
|
||||||
block_create_stats_ = std::move(ss.block_create_stats_);
|
block_create_stats_ = std::move(ss.block_create_stats_);
|
||||||
if (ss.out_msg_queue_size_) {
|
if (ss.out_msg_queue_size_) {
|
||||||
have_out_msg_queue_size_in_state_ = true;
|
have_out_msg_queue_size_in_state_ = true;
|
||||||
|
@ -5708,6 +5709,11 @@ Ref<vm::Cell> Collator::collate_shard_block_descr_set() {
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visits certain cells in out msg queue and dispatch queue to add them to the proof
|
||||||
|
*
|
||||||
|
* @returns True on success, Falise if error occurred
|
||||||
|
*/
|
||||||
bool Collator::prepare_msg_queue_proof() {
|
bool Collator::prepare_msg_queue_proof() {
|
||||||
auto res = old_out_msg_queue_->scan_diff(
|
auto res = old_out_msg_queue_->scan_diff(
|
||||||
*out_msg_queue_,
|
*out_msg_queue_,
|
||||||
|
@ -5732,7 +5738,32 @@ bool Collator::prepare_msg_queue_proof() {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
3);
|
2);
|
||||||
|
if (!res) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
res = old_dispatch_queue_->scan_diff(
|
||||||
|
*dispatch_queue_,
|
||||||
|
[this](td::ConstBitPtr, int, Ref<vm::CellSlice> old_value, Ref<vm::CellSlice> new_value) {
|
||||||
|
if (old_value.not_null()) {
|
||||||
|
old_value = old_dispatch_queue_->extract_value(std::move(old_value));
|
||||||
|
vm::Dictionary dispatch_dict{64};
|
||||||
|
td::uint64 dispatch_dict_size;
|
||||||
|
CHECK(block::unpack_account_dispatch_queue(old_value, dispatch_dict, dispatch_dict_size));
|
||||||
|
td::BitArray<64> max_lt;
|
||||||
|
CHECK(dispatch_dict.get_minmax_key(max_lt, true).not_null());
|
||||||
|
}
|
||||||
|
if (new_value.not_null()) {
|
||||||
|
new_value = dispatch_queue_->extract_value(std::move(new_value));
|
||||||
|
vm::Dictionary dispatch_dict{64};
|
||||||
|
td::uint64 dispatch_dict_size;
|
||||||
|
CHECK(block::unpack_account_dispatch_queue(new_value, dispatch_dict, dispatch_dict_size));
|
||||||
|
td::BitArray<64> min_lt;
|
||||||
|
CHECK(dispatch_dict.get_minmax_key(min_lt, false).not_null());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
2);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2923,7 +2923,7 @@ bool ValidateQuery::precheck_account_updates() {
|
||||||
CHECK(key_len == 256);
|
CHECK(key_len == 256);
|
||||||
return precheck_one_account_update(key, std::move(old_val_extra), std::move(new_val_extra));
|
return precheck_one_account_update(key, std::move(old_val_extra), std::move(new_val_extra));
|
||||||
},
|
},
|
||||||
3 /* check augmentation of changed nodes */)) {
|
2 /* check augmentation of changed nodes in the new dict */)) {
|
||||||
return reject_query("invalid ShardAccounts dictionary in the new state");
|
return reject_query("invalid ShardAccounts dictionary in the new state");
|
||||||
}
|
}
|
||||||
} catch (vm::VmError& err) {
|
} catch (vm::VmError& err) {
|
||||||
|
@ -3372,7 +3372,7 @@ bool ValidateQuery::precheck_message_queue_update() {
|
||||||
CHECK(key_len == 352);
|
CHECK(key_len == 352);
|
||||||
return precheck_one_message_queue_update(key, std::move(old_val_extra), std::move(new_val_extra));
|
return precheck_one_message_queue_update(key, std::move(old_val_extra), std::move(new_val_extra));
|
||||||
},
|
},
|
||||||
3 /* check augmentation of changed nodes */)) {
|
2 /* check augmentation of changed nodes in the new dict */)) {
|
||||||
return reject_query("invalid OutMsgQueue dictionary in the new state");
|
return reject_query("invalid OutMsgQueue dictionary in the new state");
|
||||||
}
|
}
|
||||||
} catch (vm::VmError& err) {
|
} catch (vm::VmError& err) {
|
||||||
|
@ -3533,7 +3533,7 @@ bool ValidateQuery::unpack_dispatch_queue_update() {
|
||||||
return check_account_dispatch_queue_update(key, ps_.dispatch_queue_->extract_value(std::move(old_val_extra)),
|
return check_account_dispatch_queue_update(key, ps_.dispatch_queue_->extract_value(std::move(old_val_extra)),
|
||||||
ns_.dispatch_queue_->extract_value(std::move(new_val_extra)));
|
ns_.dispatch_queue_->extract_value(std::move(new_val_extra)));
|
||||||
},
|
},
|
||||||
3 /* check augmentation of changed nodes */);
|
2 /* check augmentation of changed nodes in the new dict */);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
return reject_query("invalid DispatchQueue dictionary in the new state");
|
return reject_query("invalid DispatchQueue dictionary in the new state");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue