1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

updated tonlib + fixes in vm

This commit is contained in:
ton 2020-02-20 19:56:18 +04:00
parent 28735ddc9e
commit efd47af432
42 changed files with 750 additions and 307 deletions

View file

@ -97,26 +97,12 @@ void ApplyBlock::got_block_handle(BlockHandle handle) {
written_block_data();
return;
}
if (handle_->id().is_masterchain() && !handle_->inited_proof()) {
abort_query(td::Status::Error(ErrorCode::notready, "proof is absent"));
return;
}
if (!handle_->id().is_masterchain() && !handle_->inited_proof_link()) {
abort_query(td::Status::Error(ErrorCode::notready, "proof link is absent"));
return;
}
if (handle_->is_archived()) {
finish_query();
return;
}
CHECK(handle_->inited_merge_before());
CHECK(handle_->inited_split_after());
CHECK(handle_->inited_prev());
CHECK(handle_->inited_state_root_hash());
CHECK(handle_->inited_logical_time());
if (handle_->received()) {
written_block_data();
return;
@ -149,6 +135,19 @@ void ApplyBlock::got_block_handle(BlockHandle handle) {
void ApplyBlock::written_block_data() {
VLOG(VALIDATOR_DEBUG) << "apply block: written block data for " << id_;
if (handle_->id().is_masterchain() && !handle_->inited_proof()) {
abort_query(td::Status::Error(ErrorCode::notready, "proof is absent"));
return;
}
if (!handle_->id().is_masterchain() && !handle_->inited_proof_link()) {
abort_query(td::Status::Error(ErrorCode::notready, "proof link is absent"));
return;
}
CHECK(handle_->inited_merge_before());
CHECK(handle_->inited_split_after());
CHECK(handle_->inited_prev());
CHECK(handle_->inited_state_root_hash());
CHECK(handle_->inited_logical_time());
if (handle_->is_applied() && handle_->processed()) {
finish_query();
} else {

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 "external-message.hpp"
#include "vm/boc.h"
@ -48,6 +48,9 @@ td::Result<Ref<ExtMessageQ>> ExtMessageQ::create_ext_message(td::BufferSlice dat
if (ext_msg->get_level() != 0) {
return td::Status::Error("external message must have zero level");
}
if (ext_msg->get_depth() >= max_ext_msg_depth) {
return td::Status::Error("external message is too deep");
}
vm::CellSlice cs{vm::NoVmOrd{}, ext_msg};
if (cs.prefetch_ulong(2) != 2) { // ext_in_msg_info$10
return td::Status::Error("external message must begin with ext_in_msg_info$10");

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
*/
#pragma once
@ -34,6 +34,7 @@ class ExtMessageQ : public ExtMessage {
public:
static constexpr unsigned max_ext_msg_size = 65535;
static constexpr unsigned max_ext_msg_depth = 512;
AccountIdPrefixFull shard() const override {
return addr_prefix_;
}