1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-12 19:22:37 +00:00
ton/crypto/block/check-proof.h
Marat 078aabe50e
Add method listBlockTransactionsExt to liteserver (#399)
* Verify proof for method blocks.getTransactions

* check completeness of response

* fix start_lt

* fix mode & 128, check bTxes->ids_ out of bounds

* Improve gitactions; separate cpp-check (#346)

* Use ninja build tool and compile blockchain-explorer

Ninja builds TON much faster;

* Use clang instead of gcc

* remove blockchain-explorer

since target not found on github action

* move ccpcheck to other gitaction

* run nativelib-java only against wallets branch for now

* rename gitaction

* Update windows2019x64-tonlib-java.yml

* Update windows2019x64-tonlib-java.yml

* Update macos-10.15-tonlib-java.yml

* Update windows2019x64-tonlib-java.yml

* Update windows2019x64-tonlib-java.yml

* rebase

* update tlo's

* Revert "Improve gitactions; separate cpp-check (#346)"

This reverts commit bd1d96e6d391e48840d81cfcf10d2692848e504e.

* add checks, simplify ls response

* Revert workflows

* Add verifying proofs

* fix win build

---------

Co-authored-by: neodiX42 <namlem@gmail.com>
2023-03-07 19:49:25 +03:00

123 lines
3.8 KiB
C++

/*
This file is part of TON Blockchain Library.
TON Blockchain Library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
TON Blockchain Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
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-2020 Telegram Systems LLP
*/
#pragma once
#include "vm/cells.h"
#include "block/block.h"
namespace block {
using td::Ref;
td::Status check_block_header_proof(td::Ref<vm::Cell> root, ton::BlockIdExt blkid,
ton::Bits256* store_state_hash_to = nullptr, bool check_state_hash = false,
td::uint32* save_utime = nullptr, ton::LogicalTime* save_lt = nullptr);
td::Status check_shard_proof(ton::BlockIdExt blk, ton::BlockIdExt shard_blk, td::Slice shard_proof);
td::Status check_account_proof(td::Slice proof, ton::BlockIdExt shard_blk, const block::StdAddress& addr,
td::Ref<vm::Cell> root, ton::LogicalTime* last_trans_lt = nullptr,
ton::Bits256* last_trans_hash = nullptr, td::uint32* save_utime = nullptr,
ton::LogicalTime* save_lt = nullptr);
td::Result<td::Bits256> check_state_proof(ton::BlockIdExt blkid, td::Slice proof);
td::Result<Ref<vm::Cell>> check_extract_state_proof(ton::BlockIdExt blkid, td::Slice proof, td::Slice data);
td::Status check_block_signatures(const std::vector<ton::ValidatorDescr>& nodes,
const std::vector<ton::BlockSignature>& signatures, const ton::BlockIdExt& blkid);
struct AccountState {
ton::BlockIdExt blk;
ton::BlockIdExt shard_blk;
td::BufferSlice shard_proof;
td::BufferSlice proof;
td::BufferSlice state;
bool is_virtualized{false};
struct Info {
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};
};
td::Result<Info> validate(ton::BlockIdExt ref_blk, block::StdAddress addr) const;
};
struct Transaction {
ton::BlockIdExt blkid;
ton::LogicalTime lt;
ton::Bits256 hash;
td::Ref<vm::Cell> root;
struct Info {
ton::BlockIdExt blkid;
td::uint32 now;
ton::LogicalTime prev_trans_lt;
ton::Bits256 prev_trans_hash;
td::Ref<vm::Cell> transaction;
};
td::Result<Info> validate();
};
struct TransactionList {
ton::LogicalTime lt;
ton::Bits256 hash;
std::vector<ton::BlockIdExt> blkids;
td::BufferSlice transactions_boc;
struct Info {
ton::LogicalTime lt;
ton::Bits256 hash;
std::vector<Transaction::Info> transactions;
};
td::Result<Info> validate() const;
};
struct BlockTransaction {
ton::BlockIdExt blkid;
td::Ref<vm::Cell> root;
td::Ref<vm::Cell> proof;
struct Info {
ton::BlockIdExt blkid;
td::uint32 now;
ton::LogicalTime lt;
ton::Bits256 hash;
td::Ref<vm::Cell> transaction;
};
td::Result<Info> validate(bool check_proof) const;
};
struct BlockTransactionList {
ton::BlockIdExt blkid;
td::BufferSlice transactions_boc;
td::BufferSlice proof_boc;
ton::LogicalTime start_lt;
td::Bits256 start_addr;
bool reverse_mode;
int req_count;
struct Info {
ton::BlockIdExt blkid;
std::vector<BlockTransaction::Info> transactions;
};
td::Result<Info> validate(bool check_proof) const;
};
} // namespace block