mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Tonlib patch (#966)
* Bugfix in tonlib * Fix calling actors in RunEmulator * Fix checking proofs in blocks.getTransactions and blocks.getShards * tonlib-cli: Fix printing special cells --------- Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
190aa6bd4a
commit
25f61dff16
2 changed files with 19 additions and 8 deletions
|
@ -1891,7 +1891,9 @@ class RunEmulator : public TonlibQueryActor {
|
||||||
if (stopped_) {
|
if (stopped_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
get_block_id([self = this](td::Result<FullBlockId>&& block_id) { self->set_block_id(std::move(block_id)); });
|
get_block_id([SelfId = actor_id(this)](td::Result<FullBlockId>&& block_id) {
|
||||||
|
td::actor::send_closure(SelfId, &RunEmulator::set_block_id, std::move(block_id));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_block_id(td::Result<FullBlockId>&& block_id) {
|
void set_block_id(td::Result<FullBlockId>&& block_id) {
|
||||||
|
@ -1900,8 +1902,12 @@ class RunEmulator : public TonlibQueryActor {
|
||||||
} else {
|
} else {
|
||||||
block_id_ = block_id.move_as_ok();
|
block_id_ = block_id.move_as_ok();
|
||||||
|
|
||||||
get_mc_state_root([self = this](td::Result<td::Ref<vm::Cell>>&& mc_state_root) { self->set_mc_state_root(std::move(mc_state_root)); });
|
get_mc_state_root([SelfId = actor_id(this)](td::Result<td::Ref<vm::Cell>>&& mc_state_root) {
|
||||||
get_account_state([self = this](td::Result<td::unique_ptr<AccountState>>&& state) { self->set_account_state(std::move(state)); });
|
td::actor::send_closure(SelfId, &RunEmulator::set_mc_state_root, std::move(mc_state_root));
|
||||||
|
});
|
||||||
|
get_account_state([SelfId = actor_id(this)](td::Result<td::unique_ptr<AccountState>>&& state) {
|
||||||
|
td::actor::send_closure(SelfId, &RunEmulator::set_account_state, std::move(state));
|
||||||
|
});
|
||||||
check(get_transactions(0));
|
check(get_transactions(0));
|
||||||
|
|
||||||
inc();
|
inc();
|
||||||
|
@ -1923,7 +1929,9 @@ class RunEmulator : public TonlibQueryActor {
|
||||||
} else {
|
} else {
|
||||||
account_state_ = account_state.move_as_ok();
|
account_state_ = account_state.move_as_ok();
|
||||||
send_query(int_api::ScanAndLoadGlobalLibs{account_state_->get_raw_state()},
|
send_query(int_api::ScanAndLoadGlobalLibs{account_state_->get_raw_state()},
|
||||||
[self = this](td::Result<vm::Dictionary> R) { self->set_global_libraries(std::move(R)); });
|
[SelfId = actor_id(this)](td::Result<vm::Dictionary> R) {
|
||||||
|
td::actor::send_closure(SelfId, &RunEmulator::set_global_libraries, std::move(R));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5521,7 +5529,7 @@ td::Status TonlibClient::do_request(const tonlib_api::blocks_getShards& request,
|
||||||
}
|
}
|
||||||
|
|
||||||
block::ShardConfig sh_conf;
|
block::ShardConfig sh_conf;
|
||||||
if (!sh_conf.unpack(mc_extra.shard_hashes)) {
|
if (!sh_conf.unpack(data_csr)) {
|
||||||
return td::Status::Error("cannot extract shard block list from shard configuration");
|
return td::Status::Error("cannot extract shard block list from shard configuration");
|
||||||
}
|
}
|
||||||
auto ids = sh_conf.get_shard_hash_ids(true);
|
auto ids = sh_conf.get_shard_hash_ids(true);
|
||||||
|
@ -5544,7 +5552,9 @@ td::Status TonlibClient::do_request(const tonlib_api::blocks_getShards& request,
|
||||||
return td::Status::OK();
|
return td::Status::OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
td::Status check_lookup_block_proof(lite_api_ptr<ton::lite_api::liteServer_lookupBlockResult>& result, int mode, ton::BlockId blkid, ton::BlockIdExt client_mc_blkid, td::uint64 lt, td::uint32 utime);
|
td::Status check_lookup_block_proof(lite_api_ptr<ton::lite_api::liteServer_lookupBlockResult>& result, int mode,
|
||||||
|
ton::BlockId blkid, ton::BlockIdExt client_mc_blkid, td::uint64 lt,
|
||||||
|
td::uint32 utime);
|
||||||
|
|
||||||
td::Status TonlibClient::do_request(const tonlib_api::blocks_lookupBlock& request,
|
td::Status TonlibClient::do_request(const tonlib_api::blocks_lookupBlock& request,
|
||||||
td::Promise<object_ptr<tonlib_api::ton_blockIdExt>>&& promise) {
|
td::Promise<object_ptr<tonlib_api::ton_blockIdExt>>&& promise) {
|
||||||
|
@ -5730,7 +5740,7 @@ auto to_tonlib_api(const ton::lite_api::liteServer_transactionId& txid)
|
||||||
|
|
||||||
td::Status check_block_transactions_proof(lite_api_ptr<ton::lite_api::liteServer_blockTransactions>& bTxes, int32_t mode,
|
td::Status check_block_transactions_proof(lite_api_ptr<ton::lite_api::liteServer_blockTransactions>& bTxes, int32_t mode,
|
||||||
ton::LogicalTime start_lt, td::Bits256 start_addr, td::Bits256 root_hash, int req_count) {
|
ton::LogicalTime start_lt, td::Bits256 start_addr, td::Bits256 root_hash, int req_count) {
|
||||||
if (mode & ton::lite_api::liteServer_listBlockTransactions::WANT_PROOF_MASK == 0) {
|
if ((mode & ton::lite_api::liteServer_listBlockTransactions::WANT_PROOF_MASK) == 0) {
|
||||||
return td::Status::OK();
|
return td::Status::OK();
|
||||||
}
|
}
|
||||||
constexpr int max_answer_transactions = 256;
|
constexpr int max_answer_transactions = 256;
|
||||||
|
|
|
@ -1423,7 +1423,8 @@ class TonlibCli : public td::actor::Actor {
|
||||||
if (r_cell.is_error()) {
|
if (r_cell.is_error()) {
|
||||||
sb << "<INVALID_CELL>";
|
sb << "<INVALID_CELL>";
|
||||||
}
|
}
|
||||||
auto cs = vm::load_cell_slice(r_cell.move_as_ok());
|
bool spec = true;
|
||||||
|
auto cs = vm::load_cell_slice_special(r_cell.move_as_ok(), spec);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
cs.print_rec(ss);
|
cs.print_rec(ss);
|
||||||
sb << ss.str();
|
sb << ss.str();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue