Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions blockchain-explorer/blockchain-explorer-query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "vm/cellops.h"
#include "vm/cells/MerkleProof.h"
#include "vm/cp0.h"
#include "vm/memo.h"
#include "vm/vm.h"

#include "blockchain-explorer-http.hpp"
Expand Down Expand Up @@ -1299,6 +1300,8 @@ HttpQueryRunMethod::HttpQueryRunMethod(std::map<std::string, std::string> opts,
}
it = opts.find("params");
if (it != opts.end()) {
vm::FakeVmStateLimits fstate(1000);
vm::VmStateInterface::Guard guard(&fstate);
auto R3 = vm::parse_stack_entries(it->second);
if (R3.is_error()) {
error_ = R3.move_as_error();
Expand Down Expand Up @@ -1365,6 +1368,8 @@ void HttpQueryRunMethod::got_result(td::BufferSlice data) {
return A.finish();
}
auto cs = vm::load_cell_slice(r_cell.move_as_ok());
vm::FakeVmStateLimits fstate(1000);
vm::VmStateInterface::Guard guard(&fstate);
td::Ref<vm::Stack> stack;
if (!(vm::Stack::deserialize_to(cs, stack, 0) && cs.empty_ext())) {
A.abort("VM result boc cannot be deserialized");
Expand Down
2 changes: 1 addition & 1 deletion catchain/catchain-received-block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void CatChainReceivedBlockImpl::initialize(tl_object_ptr<ton_api::catchain_block
return;
}
for (CatChainReceivedBlockImpl *X : block_deps_) {
if (X->is_ill()) {
if (X->is_ill() || X->get_height() == 0) {
set_ill();
return;
}
Expand Down
28 changes: 21 additions & 7 deletions crypto/block/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,13 +656,17 @@ td::Status Account::init_account_storage_stat(Ref<vm::Cell> dict_root) {
if (!storage_dict_hash) {
return td::Status::Error("cannot init storage dict: storage_dict_hash is not set");
}
auto storage_for_stat = storage_without_extra_currencies(storage);
if (storage_for_stat.is_null()) {
return td::Status::Error("cannot init storage dict: invalid storage");
}
// Root of AccountStorage is not counted in AccountStorageStat
if (storage_used.cells < 1 || storage_used.bits < storage->size()) {
return td::Status::Error(PSTRING() << "storage_used is too small: cells=" << storage_used.cells
<< " bits=" << storage_used.bits << " storage_root_bits=" << storage->size());
if (storage_used.cells < 1 || storage_used.bits < storage_for_stat->size()) {
return td::Status::Error(PSTRING() << "storage_used is too small: cells=" << storage_used.cells << " bits="
<< storage_used.bits << " storage_root_bits=" << storage_for_stat->size());
}
AccountStorageStat new_stat(std::move(dict_root), storage->prefetch_all_refs(), storage_used.cells - 1,
storage_used.bits - storage->size());
AccountStorageStat new_stat(std::move(dict_root), storage_for_stat->prefetch_all_refs(), storage_used.cells - 1,
storage_used.bits - storage_for_stat->size());
TRY_RESULT(root_hash, new_stat.get_dict_hash());
if (storage_dict_hash.value() != root_hash) {
return td::Status::Error(PSTRING() << "invalid storage dict hash: computed " << root_hash.to_hex() << ", found "
Expand Down Expand Up @@ -877,11 +881,17 @@ bool Transaction::unpack_input_msg(bool ihr_delivered, const ActionPhaseConfig*
if (cfg->global_version >= 12) {
ihr_fee = td::zero_refint();
in_msg_extra_flags = tlb::t_Grams.as_integer(in_msg_info.extra_flags);
if (in_msg_extra_flags.is_null()) {
return false;
}
new_bounce_format = in_msg_extra_flags->get_bit(0);
new_bounce_format_full_body = in_msg_extra_flags->get_bit(1);
} else {
// Legacy: extra_flags was previously ihr_fee
ihr_fee = tlb::t_Grams.as_integer(in_msg_info.extra_flags);
if (ihr_fee.is_null()) {
return false;
}
}
if (ihr_delivered) {
in_fwd_fee = std::move(ihr_fee);
Expand Down Expand Up @@ -1464,7 +1474,8 @@ bool Transaction::prepare_rand_seed(td::BitArray<256>& rand_seed, const ComputeP
if (cfg.global_version >= 8) {
(data.bits() + 256).copy_from(account.addr.cbits(), 256);
} else {
(data.bits() + 256).copy_from(account.addr_rewrite.cbits(), 256);
(data.bits() + 256).copy_from(account.addr_rewrite.cbits(), 32);
(data.bits() + 256 + 32).copy_from(account.addr.cbits(), 256 - 32);
}
rand_seed.clear();
data.compute_sha256(rand_seed);
Expand Down Expand Up @@ -2689,13 +2700,16 @@ int Transaction::try_action_send_msg(const vm::CellSlice& cs0, ActionPhase& ap,
} else {
fwd_fee = tlb::t_Grams.as_integer(info.fwd_fee);
ihr_fee = cfg.global_version >= 12 ? td::zero_refint() : tlb::t_Grams.as_integer(info.extra_flags);
if (fwd_fee.is_null() || ihr_fee.is_null()) {
return -1;
}
}
if (cfg.disable_ihr_flag) {
info.ihr_disabled = true;
}
if (cfg.global_version >= 12) {
td::RefInt256 extra_flags = tlb::t_Grams.as_integer(info.extra_flags);
if (td::cmp(extra_flags & td::make_refint(3), extra_flags) != 0) {
if (extra_flags.is_null() || td::cmp(extra_flags & td::make_refint(3), extra_flags) != 0) {
LOG(DEBUG) << "invalid extra_flags in a proposed outbound message";
return check_skip_invalid(45);
}
Expand Down
Loading
Loading