1
0
Fork 0
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:
ton 2020-02-28 14:28:47 +04:00
parent 9e4816e7f6
commit e27fb1e09c
100 changed files with 3692 additions and 1299 deletions

View file

@ -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 "collator-impl.h"
#include "vm/boc.h"
@ -589,9 +589,9 @@ void Collator::got_neighbor_out_queue(int i, td::Result<Ref<MessageQueue>> res)
return;
}
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
CHECK(block::gen::t_OutMsgQueueInfo.validate_ref(outq_descr->root_cell()));
CHECK(block::tlb::t_OutMsgQueueInfo.validate_ref(outq_descr->root_cell()));
// comment the next two lines in the future when the output queues become huge
// 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) {
@ -1506,7 +1506,7 @@ bool Collator::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) &&
@ -1781,7 +1781,7 @@ bool Collator::out_msg_queue_cleanup() {
block::gen::t_OutMsgQueue.print(std::cerr, *rt);
rt->print_rec(std::cerr);
}
CHECK(block::gen::t_OutMsgQueue.validate(*rt)); // DEBUG, comment later if SLOW
// CHECK(block::gen::t_OutMsgQueue.validate_upto(100000, *rt)); // DEBUG, comment later if SLOW
return register_out_msg_queue_op(true);
}
@ -1853,13 +1853,13 @@ bool Collator::combine_account_transactions() {
block::gen::t_AccountBlock.print_ref(std::cerr, cell);
csr->print_rec(std::cerr);
}
if (!block::gen::t_AccountBlock.validate_ref(cell)) {
if (!block::gen::t_AccountBlock.validate_ref(100000, cell)) {
block::gen::t_AccountBlock.print_ref(std::cerr, cell);
csr->print_rec(std::cerr);
return fatal_error(std::string{"new AccountBlock for "} + z.first.to_hex() +
" failed to pass automatic validation tests");
}
if (!block::tlb::t_AccountBlock.validate_ref(cell)) {
if (!block::tlb::t_AccountBlock.validate_ref(100000, cell)) {
block::gen::t_AccountBlock.print_ref(std::cerr, cell);
csr->print_rec(std::cerr);
return fatal_error(std::string{"new AccountBlock for "} + z.first.to_hex() +
@ -1923,10 +1923,10 @@ bool Collator::combine_account_transactions() {
block::gen::t_ShardAccountBlocks.print_ref(std::cerr, shard_account_blocks_);
vm::load_cell_slice(shard_account_blocks_).print_rec(std::cerr);
}
if (!block::gen::t_ShardAccountBlocks.validate_ref(shard_account_blocks_)) {
if (!block::gen::t_ShardAccountBlocks.validate_ref(100000, shard_account_blocks_)) {
return fatal_error("new ShardAccountBlocks failed to pass automatic validity tests");
}
if (!block::tlb::t_ShardAccountBlocks.validate_ref(shard_account_blocks_)) {
if (!block::tlb::t_ShardAccountBlocks.validate_ref(100000, shard_account_blocks_)) {
return fatal_error("new ShardAccountBlocks failed to pass handwritten validity tests");
}
auto shard_accounts = account_dict->get_root();
@ -1937,10 +1937,10 @@ bool Collator::combine_account_transactions() {
}
if (verify >= 2) {
LOG(INFO) << "verifying new ShardAccounts";
if (!block::gen::t_ShardAccounts.validate(*shard_accounts)) {
if (!block::gen::t_ShardAccounts.validate_upto(100000, *shard_accounts)) {
return fatal_error("new ShardAccounts failed to pass automatic validity tests");
}
if (!block::tlb::t_ShardAccounts.validate(*shard_accounts)) {
if (!block::tlb::t_ShardAccounts.validate_upto(100000, *shard_accounts)) {
return fatal_error("new ShardAccounts failed to pass handwritten validity tests");
}
}
@ -3012,7 +3012,7 @@ bool Collator::create_mc_state_extra() {
std::cerr << "updated shard configuration to ";
block::gen::t_ShardHashes.print(std::cerr, *state_extra.shard_hashes);
}
if (!block::gen::t_ShardHashes.validate(*state_extra.shard_hashes)) {
if (!block::gen::t_ShardHashes.validate_upto(10000, *state_extra.shard_hashes)) {
return fatal_error("new ShardHashes is invalid");
}
// 4. check extension flags
@ -3110,7 +3110,7 @@ bool Collator::create_mc_state_extra() {
state_extra.r1.block_create_stats = cs;
if (verify >= 2) {
LOG(INFO) << "verifying new BlockCreateStats";
if (!block::gen::t_BlockCreateStats.validate_csr(cs)) {
if (!block::gen::t_BlockCreateStats.validate_csr(100000, cs)) {
cs->print_rec(std::cerr);
block::gen::t_BlockCreateStats.print(std::cerr, *cs);
return fatal_error("BlockCreateStats in the new masterchain state failed to pass automated validity checks");
@ -3128,8 +3128,8 @@ bool Collator::create_mc_state_extra() {
}
if (verify >= 2) {
LOG(INFO) << "verifying new McStateExtra";
CHECK(block::gen::t_McStateExtra.validate_ref(mc_state_extra_));
CHECK(block::tlb::t_McStateExtra.validate_ref(mc_state_extra_));
CHECK(block::gen::t_McStateExtra.validate_ref(1000000, mc_state_extra_));
CHECK(block::tlb::t_McStateExtra.validate_ref(1000000, mc_state_extra_));
}
LOG(INFO) << "McStateExtra created";
return true;
@ -3467,8 +3467,8 @@ bool Collator::create_shard_state() {
}
if (verify >= 2) {
LOG(INFO) << "verifying new ShardState";
CHECK(block::gen::t_ShardState.validate_ref(state_root));
CHECK(block::tlb::t_ShardState.validate_ref(state_root));
CHECK(block::gen::t_ShardState.validate_ref(1000000, state_root));
CHECK(block::tlb::t_ShardState.validate_ref(1000000, state_root));
}
LOG(INFO) << "creating Merkle update for the ShardState";
state_update = vm::MerkleUpdate::generate(prev_state_root_, state_root, state_usage_tree_.get());
@ -3688,7 +3688,7 @@ bool Collator::create_block() {
}
if (verify >= 1) {
LOG(INFO) << "verifying new Block";
if (!block::gen::t_Block.validate_ref(new_block)) {
if (!block::gen::t_Block.validate_ref(1000000, new_block)) {
return fatal_error("new Block failed to pass automatic validity tests");
}
}
@ -3836,10 +3836,10 @@ td::Result<bool> Collator::register_external_message_cell(Ref<vm::Cell> ext_msg,
return td::Status::Error("external message has been rejected before");
}
}
if (!block::gen::t_Message_Any.validate_ref(ext_msg)) {
if (!block::gen::t_Message_Any.validate_ref(256, ext_msg)) {
return td::Status::Error("external message is not a (Message Any) according to automated checks");
}
if (!block::tlb::t_Message.validate_ref(ext_msg)) {
if (!block::tlb::t_Message.validate_ref(256, ext_msg)) {
return td::Status::Error("external message is not a (Message Any) according to hand-written checks");
}
block::gen::CommonMsgInfo::Record_ext_in_msg_info info;