mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
func: bugfix
- bugfix in func - vertseqno support in validator/collator/topsharddescr
This commit is contained in:
parent
29deff15c3
commit
f67f5d879b
10 changed files with 78 additions and 20 deletions
|
@ -378,7 +378,7 @@ bool ValidateQuery::init_parse() {
|
|||
block::gen::ExtBlkRef::Record mcref; // _ ExtBlkRef = BlkMasterInfo;
|
||||
ShardIdFull shard;
|
||||
if (!(tlb::unpack_cell(block_root_, blk) && tlb::unpack_cell(blk.info, info) && !info.version &&
|
||||
block::tlb::t_ShardIdent.unpack(info.shard.write(), shard) && !info.vert_seq_no &&
|
||||
block::tlb::t_ShardIdent.unpack(info.shard.write(), shard) &&
|
||||
block::gen::BlkPrevInfo{info.after_merge}.validate_ref(info.prev_ref) &&
|
||||
(!info.not_master || tlb::unpack_cell(info.master_ref, mcref)) && tlb::unpack_cell(blk.extra, extra))) {
|
||||
return reject_query("cannot unpack block header");
|
||||
|
@ -393,6 +393,7 @@ bool ValidateQuery::init_parse() {
|
|||
return fatal_error("invalid Merkle update in block");
|
||||
}
|
||||
global_id_ = blk.global_id;
|
||||
vert_seqno_ = info.vert_seq_no;
|
||||
prev_state_hash_ = upd_cs.prefetch_ref(0)->get_hash(0).bits();
|
||||
state_hash_ = upd_cs.prefetch_ref(1)->get_hash(0).bits();
|
||||
start_lt_ = info.start_lt;
|
||||
|
@ -428,6 +429,9 @@ bool ValidateQuery::init_parse() {
|
|||
if (is_key_block_ && !shard.is_masterchain()) {
|
||||
return reject_query("a non-masterchain block cannot be a key block");
|
||||
}
|
||||
if (info.vert_seqno_incr) {
|
||||
return reject_query("new blocks cannot have vert_seqno_incr set");
|
||||
}
|
||||
if (info.after_merge != after_merge_) {
|
||||
return reject_query("after_merge value mismatch in block header");
|
||||
}
|
||||
|
@ -683,7 +687,13 @@ bool ValidateQuery::try_unpack_mc_state() {
|
|||
CHECK(!mc_seqno_ || new_shard_conf_->get_mc_hash().not_null());
|
||||
}
|
||||
if (global_id_ != config_->get_global_blockchain_id()) {
|
||||
return reject_query("blockchain global id mismatch");
|
||||
return reject_query(PSTRING() << "blockchain global id mismatch: new block has " << global_id_
|
||||
<< " while the masterchain configuration expects "
|
||||
<< config_->get_global_blockchain_id());
|
||||
}
|
||||
if (vert_seqno_ != config_->get_vert_seqno()) {
|
||||
return reject_query(PSTRING() << "vertical seqno mismatch: new block has " << vert_seqno_
|
||||
<< " while the masterchain configuration expects " << config_->get_vert_seqno());
|
||||
}
|
||||
prev_key_block_exists_ = config_->get_last_key_block(prev_key_block_, prev_key_block_lt_);
|
||||
if (prev_key_block_exists_) {
|
||||
|
@ -1102,6 +1112,10 @@ bool ValidateQuery::unpack_one_prev_state(block::ShardState& ss, BlockIdExt blki
|
|||
if (res.is_error()) {
|
||||
return fatal_error(std::move(res));
|
||||
}
|
||||
if (ss.vert_seqno_ > vert_seqno_) {
|
||||
return reject_query(PSTRING() << "one of previous states " << ss.id_.to_str() << " has vertical seqno "
|
||||
<< ss.vert_seqno_ << " larger than that of the new block " << vert_seqno_);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1148,6 +1162,10 @@ bool ValidateQuery::unpack_next_state() {
|
|||
return reject_query("new state refers to masterchain block "s + ns_.mc_blk_ref_.to_str() + " different from " +
|
||||
mc_blkid_.to_str() + " indicated in block header");
|
||||
}
|
||||
if (ns_.vert_seqno_ != vert_seqno_) {
|
||||
return reject_query(PSTRING() << "new state has vertical seqno " << ns_.vert_seqno_ << " different from "
|
||||
<< vert_seqno_ << " declared in the new block header");
|
||||
}
|
||||
// ...
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue