mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
liteclient signature check support
1. update liteclient/liteserver. Now liteserver sends signatures of blocks and liteclient checks them. I.e. liteclient completely checks received data. 2. validator-engine: more GC options 3. blockchain-explorer: show all block transactions (instead of 256) 4. some bugfixes
This commit is contained in:
parent
d8244eff53
commit
9d6853ef24
58 changed files with 1480 additions and 325 deletions
|
@ -1003,47 +1003,47 @@ std::vector<ton::BlockId> ShardConfig::get_shard_hash_ids(
|
|||
std::vector<ton::BlockId> res;
|
||||
bool mcout = mc_shard_hash_.is_null() || !mc_shard_hash_->seqno(); // include masterchain as a shard if seqno > 0
|
||||
bool ok = shard_hashes_dict_->check_for_each(
|
||||
[&res, &mcout, mc_shard_hash_ = mc_shard_hash_, &filter](Ref<vm::CellSlice> cs_ref, td::ConstBitPtr key,
|
||||
int n) -> bool {
|
||||
int workchain = (int)key.get_int(n);
|
||||
if (workchain >= 0 && !mcout) {
|
||||
if (filter(ton::ShardIdFull{ton::masterchainId}, true)) {
|
||||
res.emplace_back(mc_shard_hash_->blk_.id);
|
||||
}
|
||||
mcout = true;
|
||||
}
|
||||
if (!cs_ref->have_refs()) {
|
||||
return false;
|
||||
}
|
||||
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)};
|
||||
unsigned long long shard = stack.top().second;
|
||||
stack.pop();
|
||||
int t = (int)cs.fetch_ulong(1);
|
||||
if (t < 0) {
|
||||
return false;
|
||||
}
|
||||
if (!filter(ton::ShardIdFull{workchain, shard}, !t)) {
|
||||
continue;
|
||||
}
|
||||
if (!t) {
|
||||
if (!(cs.advance(4) && cs.have(32))) {
|
||||
[&res, &mcout, mc_shard_hash_ = mc_shard_hash_, &filter ](Ref<vm::CellSlice> cs_ref, td::ConstBitPtr key, int n)
|
||||
->bool {
|
||||
int workchain = (int)key.get_int(n);
|
||||
if (workchain >= 0 && !mcout) {
|
||||
if (filter(ton::ShardIdFull{ton::masterchainId}, true)) {
|
||||
res.emplace_back(mc_shard_hash_->blk_.id);
|
||||
}
|
||||
mcout = true;
|
||||
}
|
||||
if (!cs_ref->have_refs()) {
|
||||
return false;
|
||||
}
|
||||
res.emplace_back(workchain, shard, (int)cs.prefetch_ulong(32));
|
||||
continue;
|
||||
}
|
||||
unsigned long long delta = (td::lower_bit64(shard) >> 1);
|
||||
if (!delta || cs.size_ext() != 0x20000) {
|
||||
return false;
|
||||
}
|
||||
stack.emplace(cs.prefetch_ref(1), shard + delta);
|
||||
stack.emplace(cs.prefetch_ref(0), shard - delta);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
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)};
|
||||
unsigned long long shard = stack.top().second;
|
||||
stack.pop();
|
||||
int t = (int)cs.fetch_ulong(1);
|
||||
if (t < 0) {
|
||||
return false;
|
||||
}
|
||||
if (!filter(ton::ShardIdFull{workchain, shard}, !t)) {
|
||||
continue;
|
||||
}
|
||||
if (!t) {
|
||||
if (!(cs.advance(4) && cs.have(32))) {
|
||||
return false;
|
||||
}
|
||||
res.emplace_back(workchain, shard, (int)cs.prefetch_ulong(32));
|
||||
continue;
|
||||
}
|
||||
unsigned long long delta = (td::lower_bit64(shard) >> 1);
|
||||
if (!delta || cs.size_ext() != 0x20000) {
|
||||
return false;
|
||||
}
|
||||
stack.emplace(cs.prefetch_ref(1), shard + delta);
|
||||
stack.emplace(cs.prefetch_ref(0), shard - delta);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
true);
|
||||
if (!ok) {
|
||||
return {};
|
||||
|
@ -1399,8 +1399,8 @@ td::Result<std::vector<ton::StdSmcAddress>> Config::get_special_smartcontracts(b
|
|||
return td::Status::Error(-666, "configuration loaded without fundamental smart contract list");
|
||||
}
|
||||
std::vector<ton::StdSmcAddress> res;
|
||||
if (!special_smc_dict->check_for_each([&res, &without_config, conf_addr = config_addr.bits()](
|
||||
Ref<vm::CellSlice> cs_ref, td::ConstBitPtr key, int n) {
|
||||
if (!special_smc_dict->check_for_each([&res, &without_config, conf_addr = config_addr.bits() ](
|
||||
Ref<vm::CellSlice> cs_ref, td::ConstBitPtr key, int n) {
|
||||
if (cs_ref->size_ext() || n != 256) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1565,7 +1565,7 @@ std::vector<ton::ValidatorDescr> Config::do_compute_validator_set(const block::C
|
|||
ton::ShardIdFull shard,
|
||||
const block::ValidatorSet& vset, ton::UnixTime time,
|
||||
ton::CatchainSeqno cc_seqno) {
|
||||
LOG(DEBUG) << "in Config::do_compute_validator_set() for " << shard.to_str() << " ; cc_seqno=" << cc_seqno;
|
||||
// LOG(DEBUG) << "in Config::do_compute_validator_set() for " << shard.to_str() << " ; cc_seqno=" << cc_seqno;
|
||||
std::vector<ton::ValidatorDescr> nodes;
|
||||
bool is_mc = shard.is_masterchain();
|
||||
unsigned count = std::min<unsigned>(is_mc ? vset.main : ccv_conf.shard_val_num, vset.total);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue