mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
changed validate broadcast logic, added new queries to
validator-engine-console
This commit is contained in:
parent
47814dca3d
commit
d8244eff53
24 changed files with 695 additions and 84 deletions
|
@ -665,9 +665,7 @@ bool ValidateQuery::try_unpack_mc_state() {
|
|||
}
|
||||
config_ = res.move_as_ok();
|
||||
CHECK(config_);
|
||||
if (mc_seqno_) {
|
||||
config_->set_block_id_ext(mc_blkid_);
|
||||
}
|
||||
config_->set_block_id_ext(mc_blkid_);
|
||||
old_shard_conf_ = std::make_unique<block::ShardConfig>(*config_);
|
||||
if (!is_masterchain()) {
|
||||
new_shard_conf_ = std::make_unique<block::ShardConfig>(*config_);
|
||||
|
@ -684,6 +682,11 @@ bool ValidateQuery::try_unpack_mc_state() {
|
|||
} else {
|
||||
prev_key_block_seqno_ = 0;
|
||||
}
|
||||
if (prev_key_seqno_ != prev_key_block_seqno_) {
|
||||
return reject_query(PSTRING() << "previous key block seqno value in candidate block header is " << prev_key_seqno_
|
||||
<< " while the correct value corresponding to reference masterchain state "
|
||||
<< mc_blkid_.to_str() << " is " << prev_key_block_seqno_);
|
||||
}
|
||||
auto limits = config_->get_block_limits(is_masterchain());
|
||||
if (limits.is_error()) {
|
||||
return fatal_error(limits.move_as_error());
|
||||
|
@ -5002,7 +5005,7 @@ bool ValidateQuery::check_mc_state_extra() {
|
|||
} else if (!new_extra.r1.last_key_block->prefetch_ulong(1)) {
|
||||
return reject_query("last_key_block:(Maybe ExtBlkRef) changed in the new state, but it became a nothing$0");
|
||||
} else {
|
||||
auto& cs = new_extra.r1.last_key_block.write();
|
||||
vm::CellSlice cs = *new_extra.r1.last_key_block;
|
||||
BlockIdExt blkid;
|
||||
LogicalTime lt;
|
||||
CHECK(cs.fetch_ulong(1) == 1 && block::tlb::t_ExtBlkRef.unpack(cs, blkid, <));
|
||||
|
@ -5017,6 +5020,20 @@ bool ValidateQuery::check_mc_state_extra() {
|
|||
", but it is not a key block");
|
||||
}
|
||||
}
|
||||
if (new_extra.r1.last_key_block->prefetch_ulong(1)) {
|
||||
auto& cs = new_extra.r1.last_key_block.write();
|
||||
BlockIdExt blkid;
|
||||
LogicalTime lt;
|
||||
CHECK(cs.fetch_ulong(1) == 1 && block::tlb::t_ExtBlkRef.unpack(cs, blkid, <));
|
||||
if (blkid != prev_key_block_) {
|
||||
return reject_query("new masterchain state declares previous key block to be "s + blkid.to_str() +
|
||||
" but the value computed from previous masterchain state is " + prev_key_block_.to_str());
|
||||
}
|
||||
} else if (prev_key_block_seqno_ > 0) {
|
||||
return reject_query(PSTRING() << "new masterchain state declares no previous key block, but the block header "
|
||||
"announces previous key block seqno "
|
||||
<< prev_key_block_seqno_);
|
||||
}
|
||||
// global_balance:CurrencyCollection
|
||||
block::CurrencyCollection global_balance, old_global_balance;
|
||||
if (!global_balance.validate_unpack(new_extra.global_balance)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue