mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
updated vm (breaking compatibility)
- updated vm - new actor scheduler - updated tonlib - updated DNS smartcontract
This commit is contained in:
parent
9e4816e7f6
commit
e27fb1e09c
100 changed files with 3692 additions and 1299 deletions
|
@ -14,7 +14,7 @@
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with TON Blockchain Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2017-2019 Telegram Systems LLP
|
||||
Copyright 2017-2020 Telegram Systems LLP
|
||||
*/
|
||||
#include "validate-query.hpp"
|
||||
#include "top-shard-descr.hpp"
|
||||
|
@ -499,7 +499,7 @@ bool ValidateQuery::extract_collated_data_from(Ref<vm::Cell> croot, int idx) {
|
|||
}
|
||||
if (block::gen::t_TopBlockDescrSet.has_valid_tag(cs)) {
|
||||
LOG(DEBUG) << "collated datum # " << idx << " is a TopBlockDescrSet";
|
||||
if (!block::gen::t_TopBlockDescrSet.validate(cs)) {
|
||||
if (!block::gen::t_TopBlockDescrSet.validate_upto(10000, cs)) {
|
||||
return reject_query("invalid TopBlockDescrSet");
|
||||
}
|
||||
if (top_shard_descr_dict_) {
|
||||
|
@ -776,7 +776,7 @@ bool ValidateQuery::fetch_config_params() {
|
|||
// fetch block_grams_created
|
||||
auto cell = config_->get_config_param(14);
|
||||
if (cell.is_null()) {
|
||||
basechain_create_fee_ = masterchain_create_fee_ = td::RefInt256{true, 0};
|
||||
basechain_create_fee_ = masterchain_create_fee_ = td::zero_refint();
|
||||
} else {
|
||||
block::gen::BlockCreateFees::Record create_fees;
|
||||
if (!(tlb::unpack_cell(cell, create_fees) &&
|
||||
|
@ -1229,8 +1229,8 @@ void ValidateQuery::got_neighbor_out_queue(int i, td::Result<Ref<MessageQueue>>
|
|||
descr.set_queue_root(qinfo.out_queue->prefetch_ref(0));
|
||||
// TODO: comment the next two lines in the future when the output queues become huge
|
||||
// (do this carefully)
|
||||
CHECK(block::gen::t_OutMsgQueueInfo.validate_ref(outq_descr->root_cell()));
|
||||
CHECK(block::tlb::t_OutMsgQueueInfo.validate_ref(outq_descr->root_cell()));
|
||||
CHECK(block::gen::t_OutMsgQueueInfo.validate_ref(1000000, outq_descr->root_cell()));
|
||||
CHECK(block::tlb::t_OutMsgQueueInfo.validate_ref(1000000, outq_descr->root_cell()));
|
||||
// unpack ProcessedUpto
|
||||
LOG(DEBUG) << "unpacking ProcessedUpto of neighbor " << descr.blk_.to_str();
|
||||
if (verbosity >= 2) {
|
||||
|
@ -2049,13 +2049,13 @@ bool ValidateQuery::unpack_block_data() {
|
|||
auto outmsg_cs = vm::load_cell_slice_ref(std::move(extra.out_msg_descr));
|
||||
// run some hand-written checks from block::tlb::
|
||||
// (automatic tests from block::gen:: have been already run for the entire block)
|
||||
if (!block::tlb::t_InMsgDescr.validate(*inmsg_cs)) {
|
||||
if (!block::tlb::t_InMsgDescr.validate_upto(1000000, *inmsg_cs)) {
|
||||
return reject_query("InMsgDescr of the new block failed to pass handwritten validity tests");
|
||||
}
|
||||
if (!block::tlb::t_OutMsgDescr.validate(*outmsg_cs)) {
|
||||
if (!block::tlb::t_OutMsgDescr.validate_upto(1000000, *outmsg_cs)) {
|
||||
return reject_query("OutMsgDescr of the new block failed to pass handwritten validity tests");
|
||||
}
|
||||
if (!block::tlb::t_ShardAccountBlocks.validate_ref(extra.account_blocks)) {
|
||||
if (!block::tlb::t_ShardAccountBlocks.validate_ref(1000000, extra.account_blocks)) {
|
||||
return reject_query("ShardAccountBlocks of the new block failed to pass handwritten validity tests");
|
||||
}
|
||||
in_msg_dict_ = std::make_unique<vm::AugmentedDictionary>(std::move(inmsg_cs), 256, block::tlb::aug_InMsgDescr);
|
||||
|
@ -2274,11 +2274,11 @@ bool ValidateQuery::precheck_one_account_update(td::ConstBitPtr acc_id, Ref<vm::
|
|||
"AccountBlock for this account");
|
||||
}
|
||||
if (new_value.not_null()) {
|
||||
if (!block::gen::t_ShardAccount.validate_csr(new_value)) {
|
||||
if (!block::gen::t_ShardAccount.validate_csr(10000, new_value)) {
|
||||
return reject_query("new state of account "s + acc_id.to_hex(256) +
|
||||
" failed to pass automated validity checks for ShardAccount");
|
||||
}
|
||||
if (!block::tlb::t_ShardAccount.validate_csr(new_value)) {
|
||||
if (!block::tlb::t_ShardAccount.validate_csr(10000, new_value)) {
|
||||
return reject_query("new state of account "s + acc_id.to_hex(256) +
|
||||
" failed to pass hand-written validity checks for ShardAccount");
|
||||
}
|
||||
|
@ -2428,10 +2428,10 @@ bool ValidateQuery::precheck_one_account_block(td::ConstBitPtr acc_id, Ref<vm::C
|
|||
return reject_query("(HASH_UPDATE Account) from the AccountBlock of "s + acc_id.to_hex(256) +
|
||||
" has incorrect new hash");
|
||||
}
|
||||
if (!block::gen::t_AccountBlock.validate(*acc_blk_root)) {
|
||||
if (!block::gen::t_AccountBlock.validate_upto(1000000, *acc_blk_root)) {
|
||||
return reject_query("AccountBlock of "s + acc_id.to_hex(256) + " failed to pass automated validity checks");
|
||||
}
|
||||
if (!block::tlb::t_AccountBlock.validate(*acc_blk_root)) {
|
||||
if (!block::tlb::t_AccountBlock.validate_upto(1000000, *acc_blk_root)) {
|
||||
return reject_query("AccountBlock of "s + acc_id.to_hex(256) + " failed to pass hand-written validity checks");
|
||||
}
|
||||
unsigned last_trans_lt_len = 1;
|
||||
|
@ -4794,10 +4794,10 @@ bool ValidateQuery::check_new_state() {
|
|||
}
|
||||
|
||||
bool ValidateQuery::check_config_update(Ref<vm::CellSlice> old_conf_params, Ref<vm::CellSlice> new_conf_params) {
|
||||
if (!block::gen::t_ConfigParams.validate_csr(new_conf_params)) {
|
||||
if (!block::gen::t_ConfigParams.validate_csr(10000, new_conf_params)) {
|
||||
return reject_query("new configuration failed to pass automated validity checks");
|
||||
}
|
||||
if (!block::gen::t_ConfigParams.validate_csr(old_conf_params)) {
|
||||
if (!block::gen::t_ConfigParams.validate_csr(10000, old_conf_params)) {
|
||||
return fatal_error("old configuration failed to pass automated validity checks");
|
||||
}
|
||||
td::Bits256 old_cfg_addr, new_cfg_addr;
|
||||
|
@ -4908,7 +4908,8 @@ bool ValidateQuery::check_one_prev_dict_update(ton::BlockSeqno seqno, Ref<vm::Ce
|
|||
}
|
||||
CHECK(new_val_extra.not_null());
|
||||
vm::CellSlice cs{*new_val_extra};
|
||||
if (!(block::gen::t_KeyMaxLt.validate_skip(cs) && block::gen::t_KeyExtBlkRef.validate_skip(cs) && cs.empty_ext())) {
|
||||
if (!(block::gen::t_KeyMaxLt.validate_skip_upto(16, cs) && block::gen::t_KeyExtBlkRef.validate_skip_upto(16, cs) &&
|
||||
cs.empty_ext())) {
|
||||
return reject_query(PSTRING() << "entry with seqno " << seqno
|
||||
<< " in the new previous blocks dictionary failed to pass automated validity checks "
|
||||
"form KeyMaxLt + KeyExtBlkRef");
|
||||
|
@ -5039,7 +5040,7 @@ bool ValidateQuery::check_mc_state_extra() {
|
|||
<< " while the block header claims is_key_block=" << is_key_block_);
|
||||
}
|
||||
// last_key_block:(Maybe ExtBlkRef)
|
||||
if (!block::gen::t_Maybe_ExtBlkRef.validate_csr(new_extra.r1.last_key_block)) {
|
||||
if (!block::gen::t_Maybe_ExtBlkRef.validate_csr(16, new_extra.r1.last_key_block)) {
|
||||
return reject_query(
|
||||
"last_key_block:(Maybe ExtBlkRef) in the new masterchain state failed to pass automated validity checks");
|
||||
}
|
||||
|
@ -5360,7 +5361,7 @@ bool ValidateQuery::try_validate() {
|
|||
}
|
||||
}
|
||||
LOG(INFO) << "running automated validity checks for block candidate " << id_.to_str();
|
||||
if (!block::gen::t_Block.validate_ref(block_root_)) {
|
||||
if (!block::gen::t_Block.validate_ref(1000000, block_root_)) {
|
||||
return reject_query("block "s + id_.to_str() + " failed to pass automated validity checks");
|
||||
}
|
||||
if (!fix_all_processed_upto()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue