mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
updated liteserver
- new methods for liteserver/liteclient - added ADNL/DHT client-only work mode - fixed crash in ADNL
This commit is contained in:
parent
acf16718e6
commit
53ec9684bd
70 changed files with 816 additions and 322 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 "check-proof.h"
|
||||
#include "block/block.h"
|
||||
|
@ -219,7 +219,17 @@ td::Status check_account_proof(td::Slice proof, ton::BlockIdExt shard_blk, const
|
|||
}
|
||||
|
||||
td::Result<AccountState::Info> AccountState::validate(ton::BlockIdExt ref_blk, block::StdAddress addr) const {
|
||||
TRY_RESULT_PREFIX(root, vm::std_boc_deserialize(state.as_slice(), true), "cannot deserialize account state");
|
||||
TRY_RESULT_PREFIX(true_root, vm::std_boc_deserialize(state.as_slice(), true), "cannot deserialize account state");
|
||||
Ref<vm::Cell> root;
|
||||
|
||||
if (is_virtualized && true_root.not_null()) {
|
||||
root = vm::MerkleProof::virtualize(true_root, 1);
|
||||
if (root.is_null()) {
|
||||
return td::Status::Error("account state proof is invalid");
|
||||
}
|
||||
} else {
|
||||
root = true_root;
|
||||
}
|
||||
|
||||
if (blk != ref_blk && ref_blk.id.seqno != ~0U) {
|
||||
return td::Status::Error(PSLICE() << "obtained getAccountState() for a different reference block " << blk.to_str()
|
||||
|
@ -241,6 +251,7 @@ td::Result<AccountState::Info> AccountState::validate(ton::BlockIdExt ref_blk, b
|
|||
TRY_STATUS(block::check_account_proof(proof.as_slice(), shard_blk, addr, root, &res.last_trans_lt,
|
||||
&res.last_trans_hash, &res.gen_utime, &res.gen_lt));
|
||||
res.root = std::move(root);
|
||||
res.true_root = std::move(true_root);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -44,10 +44,11 @@ struct AccountState {
|
|||
td::BufferSlice shard_proof;
|
||||
td::BufferSlice proof;
|
||||
td::BufferSlice state;
|
||||
bool is_virtualized{false};
|
||||
|
||||
struct Info {
|
||||
td::Ref<vm::Cell> root;
|
||||
ton::LogicalTime last_trans_lt = 0;
|
||||
td::Ref<vm::Cell> root, true_root;
|
||||
ton::LogicalTime last_trans_lt{0};
|
||||
ton::Bits256 last_trans_hash;
|
||||
ton::LogicalTime gen_lt{0};
|
||||
td::uint32 gen_utime{0};
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
exception statement from your version. If you delete this exception statement
|
||||
from all source files in the program, then also delete it here.
|
||||
|
||||
Copyright 2017-2019 Telegram Systems LLP
|
||||
Copyright 2017-2020 Telegram Systems LLP
|
||||
*/
|
||||
#include "mc-config.h"
|
||||
#include "block/block.h"
|
||||
|
@ -752,8 +752,8 @@ Ref<McShardDescr> McShardDescr::from_block(Ref<vm::Cell> block_root, Ref<vm::Cel
|
|||
return {};
|
||||
}
|
||||
// TODO: use a suitable vm::MerkleUpdate method here
|
||||
vm::CellSlice cs(vm::NoVm(), rec.state_update);
|
||||
if (cs.special_type() != vm::Cell::SpecialType::MerkleUpdate) {
|
||||
vm::CellSlice cs(vm::NoVmSpec(), rec.state_update);
|
||||
if (!cs.is_valid() || cs.special_type() != vm::Cell::SpecialType::MerkleUpdate) {
|
||||
LOG(ERROR) << "state update in a block is not a Merkle update";
|
||||
return {};
|
||||
}
|
||||
|
@ -870,7 +870,7 @@ bool ShardConfig::get_shard_hash_raw_from(vm::Dictionary& dict, vm::CellSlice& c
|
|||
unsigned long long z = id.shard, m = std::numeric_limits<unsigned long long>::max();
|
||||
int len = id.pfx_len();
|
||||
while (true) {
|
||||
cs.load(vm::NoVmOrd{}, leaf ? root : std::move(root));
|
||||
cs.load(vm::NoVmOrd(), leaf ? root : std::move(root));
|
||||
int t = (int)cs.fetch_ulong(1);
|
||||
if (t < 0) {
|
||||
return false; // throw DictError ?
|
||||
|
@ -1108,7 +1108,7 @@ std::vector<ton::BlockId> ShardConfig::get_shard_hash_ids(
|
|||
std::stack<std::pair<Ref<vm::Cell>, unsigned long long>> stack;
|
||||
stack.emplace(cs_ref->prefetch_ref(), ton::shardIdAll);
|
||||
while (!stack.empty()) {
|
||||
vm::CellSlice cs{vm::NoVm{}, std::move(stack.top().first)};
|
||||
vm::CellSlice cs{vm::NoVmOrd(), std::move(stack.top().first)};
|
||||
unsigned long long shard = stack.top().second;
|
||||
stack.pop();
|
||||
int t = (int)cs.fetch_ulong(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue