mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
bugfixes
This commit is contained in:
parent
8be3fc99ed
commit
be9c34c62d
699 changed files with 1171 additions and 978 deletions
|
@ -264,7 +264,7 @@ void ValidateQuery::start_up() {
|
|||
LOG(DEBUG) << "sending wait_block_state() query #" << i << " for " << prev_blocks[i].to_str() << " to Manager";
|
||||
++pending;
|
||||
td::actor::send_closure_later(manager, &ValidatorManager::wait_block_state_short, prev_blocks[i], priority(),
|
||||
timeout, [ self = get_self(), i ](td::Result<Ref<ShardState>> res)->void {
|
||||
timeout, [self = get_self(), i](td::Result<Ref<ShardState>> res) -> void {
|
||||
LOG(DEBUG) << "got answer to wait_block_state_short query #" << i;
|
||||
td::actor::send_closure_later(
|
||||
std::move(self), &ValidateQuery::after_get_shard_state, i, std::move(res));
|
||||
|
@ -278,16 +278,16 @@ void ValidateQuery::start_up() {
|
|||
// 5. request masterchain state referred to in the block
|
||||
if (!is_masterchain()) {
|
||||
++pending;
|
||||
td::actor::send_closure_later(manager, &ValidatorManager::wait_block_state_short, mc_blkid_, priority(),
|
||||
timeout, [self = get_self()](td::Result<Ref<ShardState>> res) {
|
||||
td::actor::send_closure_later(manager, &ValidatorManager::wait_block_state_short, mc_blkid_, priority(), timeout,
|
||||
[self = get_self()](td::Result<Ref<ShardState>> res) {
|
||||
LOG(DEBUG) << "got answer to wait_block_state() query for masterchain block";
|
||||
td::actor::send_closure_later(std::move(self), &ValidateQuery::after_get_mc_state,
|
||||
std::move(res));
|
||||
});
|
||||
// 5.1. request corresponding block handle
|
||||
++pending;
|
||||
td::actor::send_closure_later(manager, &ValidatorManager::get_block_handle, mc_blkid_,
|
||||
true, [self = get_self()](td::Result<BlockHandle> res) {
|
||||
td::actor::send_closure_later(manager, &ValidatorManager::get_block_handle, mc_blkid_, true,
|
||||
[self = get_self()](td::Result<BlockHandle> res) {
|
||||
LOG(DEBUG) << "got answer to get_block_handle() query for masterchain block";
|
||||
td::actor::send_closure_later(std::move(self), &ValidateQuery::got_mc_handle,
|
||||
std::move(res));
|
||||
|
@ -1213,7 +1213,7 @@ bool ValidateQuery::request_neighbor_queues() {
|
|||
LOG(DEBUG) << "requesting outbound queue of neighbor #" << i << " : " << descr.blk_.to_str();
|
||||
++pending;
|
||||
send_closure_later(manager, &ValidatorManager::wait_block_message_queue_short, descr.blk_, priority(), timeout,
|
||||
[ self = get_self(), i ](td::Result<Ref<MessageQueue>> res) {
|
||||
[self = get_self(), i](td::Result<Ref<MessageQueue>> res) {
|
||||
td::actor::send_closure(std::move(self), &ValidateQuery::got_neighbor_out_queue, i,
|
||||
std::move(res));
|
||||
});
|
||||
|
@ -1333,12 +1333,13 @@ bool ValidateQuery::request_aux_mc_state(BlockSeqno seqno, Ref<MasterchainStateQ
|
|||
CHECK(blkid.is_valid_ext() && blkid.is_masterchain());
|
||||
LOG(DEBUG) << "sending auxiliary wait_block_state() query for " << blkid.to_str() << " to Manager";
|
||||
++pending;
|
||||
td::actor::send_closure_later(manager, &ValidatorManager::wait_block_state_short, blkid, priority(), timeout, [
|
||||
self = get_self(), blkid
|
||||
](td::Result<Ref<ShardState>> res) {
|
||||
LOG(DEBUG) << "got answer to wait_block_state query for " << blkid.to_str();
|
||||
td::actor::send_closure_later(std::move(self), &ValidateQuery::after_get_aux_shard_state, blkid, std::move(res));
|
||||
});
|
||||
td::actor::send_closure_later(manager, &ValidatorManager::wait_block_state_short, blkid, priority(), timeout,
|
||||
[self = get_self(), blkid](td::Result<Ref<ShardState>> res) {
|
||||
LOG(DEBUG) << "got answer to wait_block_state query for " << blkid.to_str();
|
||||
td::actor::send_closure_later(std::move(self),
|
||||
&ValidateQuery::after_get_aux_shard_state, blkid,
|
||||
std::move(res));
|
||||
});
|
||||
state.clear();
|
||||
return true;
|
||||
}
|
||||
|
@ -1683,8 +1684,8 @@ bool ValidateQuery::check_shard_layout() {
|
|||
WorkchainId wc_id{ton::workchainInvalid};
|
||||
Ref<block::WorkchainInfo> wc_info;
|
||||
|
||||
if (!new_shard_conf_->process_sibling_shard_hashes([ self = this, &wc_set, &wc_id, &wc_info, &ccvc ](
|
||||
block::McShardHash & cur, const block::McShardHash* sibling) {
|
||||
if (!new_shard_conf_->process_sibling_shard_hashes([self = this, &wc_set, &wc_id, &wc_info, &ccvc](
|
||||
block::McShardHash& cur, const block::McShardHash* sibling) {
|
||||
if (!cur.is_valid()) {
|
||||
return -2;
|
||||
}
|
||||
|
@ -2342,14 +2343,14 @@ bool ValidateQuery::precheck_account_updates() {
|
|||
LOG(INFO) << "pre-checking all Account updates between the old and the new state";
|
||||
try {
|
||||
CHECK(ps_.account_dict_ && ns_.account_dict_);
|
||||
if (!ps_.account_dict_->scan_diff(*ns_.account_dict_,
|
||||
[this](td::ConstBitPtr key, int key_len, Ref<vm::CellSlice> old_val_extra,
|
||||
Ref<vm::CellSlice> new_val_extra) {
|
||||
CHECK(key_len == 256);
|
||||
return precheck_one_account_update(key, std::move(old_val_extra),
|
||||
std::move(new_val_extra));
|
||||
},
|
||||
3 /* check augmentation of changed nodes */)) {
|
||||
if (!ps_.account_dict_->scan_diff(
|
||||
*ns_.account_dict_,
|
||||
[this](td::ConstBitPtr key, int key_len, Ref<vm::CellSlice> old_val_extra,
|
||||
Ref<vm::CellSlice> new_val_extra) {
|
||||
CHECK(key_len == 256);
|
||||
return precheck_one_account_update(key, std::move(old_val_extra), std::move(new_val_extra));
|
||||
},
|
||||
3 /* check augmentation of changed nodes */)) {
|
||||
return reject_query("invalid ShardAccounts dictionary in the new state");
|
||||
}
|
||||
} catch (vm::VmError& err) {
|
||||
|
@ -2728,14 +2729,14 @@ bool ValidateQuery::precheck_message_queue_update() {
|
|||
try {
|
||||
CHECK(ps_.out_msg_queue_ && ns_.out_msg_queue_);
|
||||
CHECK(out_msg_dict_);
|
||||
if (!ps_.out_msg_queue_->scan_diff(*ns_.out_msg_queue_,
|
||||
[this](td::ConstBitPtr key, int key_len, Ref<vm::CellSlice> old_val_extra,
|
||||
Ref<vm::CellSlice> new_val_extra) {
|
||||
CHECK(key_len == 352);
|
||||
return precheck_one_message_queue_update(key, std::move(old_val_extra),
|
||||
std::move(new_val_extra));
|
||||
},
|
||||
3 /* check augmentation of changed nodes */)) {
|
||||
if (!ps_.out_msg_queue_->scan_diff(
|
||||
*ns_.out_msg_queue_,
|
||||
[this](td::ConstBitPtr key, int key_len, Ref<vm::CellSlice> old_val_extra,
|
||||
Ref<vm::CellSlice> new_val_extra) {
|
||||
CHECK(key_len == 352);
|
||||
return precheck_one_message_queue_update(key, std::move(old_val_extra), std::move(new_val_extra));
|
||||
},
|
||||
3 /* check augmentation of changed nodes */)) {
|
||||
return reject_query("invalid OutMsgQueue dictionary in the new state");
|
||||
}
|
||||
} catch (vm::VmError& err) {
|
||||
|
@ -4444,7 +4445,7 @@ bool ValidateQuery::check_one_transaction(block::Account& account, ton::LogicalT
|
|||
return reject_query(PSTRING() << "cannot re-create credit phase of transaction " << lt << " for smart contract "
|
||||
<< addr.to_hex());
|
||||
}
|
||||
if (!trs->prepare_storage_phase(storage_phase_cfg_, true)) {
|
||||
if (!trs->prepare_storage_phase(storage_phase_cfg_, true, need_credit_phase)) {
|
||||
return reject_query(PSTRING() << "cannot re-create storage phase of transaction " << lt << " for smart contract "
|
||||
<< addr.to_hex());
|
||||
}
|
||||
|
@ -4757,27 +4758,28 @@ bool ValidateQuery::check_one_library_update(td::ConstBitPtr key, Ref<vm::CellSl
|
|||
}
|
||||
if (old_value.not_null() && !block::gen::t_LibDescr.validate_csr(old_value)) {
|
||||
return reject_query("LibDescr with key "s + key.to_hex(256) +
|
||||
" in the libraries dictionary of the new state failed to pass automatic validity tests");
|
||||
" in the libraries dictionary of the old state failed to pass automatic validity tests");
|
||||
CHECK(old_value.write().advance_ext(2, 1));
|
||||
old_publishers = std::make_unique<vm::Dictionary>(vm::DictNonEmpty(), std::move(old_value), 256);
|
||||
} else {
|
||||
old_publishers = std::make_unique<vm::Dictionary>(256);
|
||||
}
|
||||
if (!old_publishers->scan_diff(*new_publishers,
|
||||
[ this, lib_key = key ](td::ConstBitPtr key, int key_len, Ref<vm::CellSlice> old_val,
|
||||
Ref<vm::CellSlice> new_val) {
|
||||
CHECK(key_len == 256);
|
||||
if (old_val.not_null() && !old_val->empty_ext()) {
|
||||
return false;
|
||||
}
|
||||
if (new_val.not_null() && !new_val->empty_ext()) {
|
||||
return false;
|
||||
}
|
||||
CHECK(old_val.not_null() != new_val.not_null());
|
||||
lib_publishers2_.emplace_back(lib_key, key, new_val.not_null());
|
||||
return true;
|
||||
},
|
||||
3 /* check augmentation of changed nodes */)) {
|
||||
if (!old_publishers->scan_diff(
|
||||
*new_publishers,
|
||||
[this, lib_key = key](td::ConstBitPtr key, int key_len, Ref<vm::CellSlice> old_val,
|
||||
Ref<vm::CellSlice> new_val) {
|
||||
CHECK(key_len == 256);
|
||||
if (old_val.not_null() && !old_val->empty_ext()) {
|
||||
return false;
|
||||
}
|
||||
if (new_val.not_null() && !new_val->empty_ext()) {
|
||||
return false;
|
||||
}
|
||||
CHECK(old_val.not_null() != new_val.not_null());
|
||||
lib_publishers2_.emplace_back(lib_key, key, new_val.not_null());
|
||||
return true;
|
||||
},
|
||||
3 /* check augmentation of changed nodes */)) {
|
||||
return reject_query("invalid publishers set for shard library with hash "s + key.to_hex(256));
|
||||
}
|
||||
return true;
|
||||
|
@ -5099,14 +5101,15 @@ bool ValidateQuery::check_mc_state_extra() {
|
|||
try {
|
||||
vm::AugmentedDictionary old_prev_dict{old_extra.r1.prev_blocks, 32, block::tlb::aug_OldMcBlocksInfo};
|
||||
vm::AugmentedDictionary new_prev_dict{new_extra.r1.prev_blocks, 32, block::tlb::aug_OldMcBlocksInfo};
|
||||
if (!old_prev_dict.scan_diff(new_prev_dict,
|
||||
[this](td::ConstBitPtr key, int key_len, Ref<vm::CellSlice> old_val_extra,
|
||||
Ref<vm::CellSlice> new_val_extra) {
|
||||
CHECK(key_len == 32);
|
||||
return check_one_prev_dict_update(
|
||||
(unsigned)key.get_uint(32), std::move(old_val_extra), std::move(new_val_extra));
|
||||
},
|
||||
3 /* check augmentation of changed nodes */)) {
|
||||
if (!old_prev_dict.scan_diff(
|
||||
new_prev_dict,
|
||||
[this](td::ConstBitPtr key, int key_len, Ref<vm::CellSlice> old_val_extra,
|
||||
Ref<vm::CellSlice> new_val_extra) {
|
||||
CHECK(key_len == 32);
|
||||
return check_one_prev_dict_update((unsigned)key.get_uint(32), std::move(old_val_extra),
|
||||
std::move(new_val_extra));
|
||||
},
|
||||
3 /* check augmentation of changed nodes */)) {
|
||||
return reject_query("invalid previous block dictionary in the new state");
|
||||
}
|
||||
td::BitArray<32> key;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue