1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Improve validator session stats

* Collator stats: block limits, number of processed external messages
* Collator and validator work time
* Last key block seqno
* Approvers and signers
This commit is contained in:
SpyCheese 2024-08-19 18:35:50 +03:00
parent 06515c3735
commit 0ca022cc72
15 changed files with 276 additions and 24 deletions

View file

@ -77,6 +77,8 @@ struct ValidatorSessionStats {
ValidatorSessionCandidateId candidate_id = ValidatorSessionCandidateId::zero();
int block_status = status_none;
double block_timestamp = -1.0;
td::Bits256 root_hash = td::Bits256::zero();
td::Bits256 file_hash = td::Bits256::zero();
std::string comment;
bool is_accepted = false;
@ -159,6 +161,7 @@ struct NewValidatorGroupStats {
ValidatorSessionId session_id = ValidatorSessionId::zero();
ShardIdFull shard{masterchainId};
CatchainSeqno cc_seqno = 0;
BlockSeqno last_key_block_seqno = 0;
double timestamp = -1.0;
td::uint32 self_idx = 0;
std::vector<Node> nodes;

View file

@ -270,6 +270,8 @@ void ValidatorSessionImpl::process_broadcast(PublicKeyHash src, td::BufferSlice
}
stat->deserialize_time = deserialize_time;
stat->serialized_size = data.size();
stat->root_hash = candidate->root_hash_;
stat->file_hash = file_hash;
}
if ((td::int32)block_round < (td::int32)cur_round_ - MAX_PAST_ROUND_BLOCK ||
@ -468,6 +470,8 @@ void ValidatorSessionImpl::generated_block(td::uint32 round, ValidatorSessionCan
stat->collated_at = td::Clocks::system();
stat->block_timestamp = td::Clocks::system();
stat->collation_cached = collation_cached;
stat->root_hash = root_hash;
stat->file_hash = file_hash;
}
if (round != cur_round_) {
return;
@ -602,6 +606,8 @@ void ValidatorSessionImpl::try_approve_block(const SentBlock *block) {
if (stat->block_timestamp <= 0.0) {
stat->block_timestamp = td::Clocks::system();
}
stat->root_hash = B->root_hash_;
stat->file_hash = td::sha256_bits256(B->data_);
}
auto P = td::PromiseCreator::lambda([round = cur_round_, hash = block_id, root_hash = block->get_root_hash(),