Skip to content

Commit

Permalink
Add more information to validatorStats.newValidatorGroup.node
Browse files Browse the repository at this point in the history
  • Loading branch information
SpyCheese committed Dec 27, 2024
1 parent 4ec34ed commit 5ce9d0b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tl/generate/scheme/ton_api.tl
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ validatorStats.validatedBlock
bytes:int collated_data_bytes:int
total_time:double work_time:double cpu_work_time:double = validatorStats.ValidatedBlock;

validatorStats.newValidatorGroup.node id:int256 weight:long = validatorStats.newValidatorGroup.Node;
validatorStats.newValidatorGroup.node id:int256 pubkey:PublicKey adnl_id:int256 weight:long = validatorStats.newValidatorGroup.Node;
validatorStats.newValidatorGroup session_id:int256 shard:tonNode.shardId cc_seqno:int
last_key_block_seqno:int started_at:double
self_idx:int self:int256 nodes:(vector validatorStats.newValidatorGroup.node) = validatorStats.NewValidatorGroup;
Expand Down
Binary file modified tl/generate/scheme/ton_api.tlo
Binary file not shown.
6 changes: 4 additions & 2 deletions validator-session/validator-session-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ struct ValidatorSessionStats {
struct NewValidatorGroupStats {
struct Node {
PublicKeyHash id = PublicKeyHash::zero();
PublicKey pubkey;
adnl::AdnlNodeIdShort adnl_id = adnl::AdnlNodeIdShort::zero();
ValidatorWeight weight = 0;
};

Expand All @@ -228,8 +230,8 @@ struct NewValidatorGroupStats {
tl_object_ptr<ton_api::validatorStats_newValidatorGroup> tl() const {
std::vector<tl_object_ptr<ton_api::validatorStats_newValidatorGroup_node>> nodes_arr;
for (const auto &node : nodes) {
nodes_arr.push_back(
create_tl_object<ton_api::validatorStats_newValidatorGroup_node>(node.id.bits256_value(), node.weight));
nodes_arr.push_back(create_tl_object<ton_api::validatorStats_newValidatorGroup_node>(
node.id.bits256_value(), node.pubkey.tl(), node.adnl_id.bits256_value(), node.weight));
}
return create_tl_object<ton_api::validatorStats_newValidatorGroup>(session_id, create_tl_shard_id(shard), cc_seqno,
last_key_block_seqno, started_at, self_idx,
Expand Down
10 changes: 7 additions & 3 deletions validator/validator-group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ void ValidatorGroup::validate_block_candidate(validatorsession::BlockSourceInfo
return;
}
VLOG(VALIDATOR_DEBUG) << "validating block candidate " << next_block_id;
run_validate_query(shard_, min_masterchain_block_id_, prev_block_ids_, std::move(block), validator_set_,
local_id_, manager_, td::Timestamp::in(15.0), std::move(P));
run_validate_query(shard_, min_masterchain_block_id_, prev_block_ids_, std::move(block), validator_set_, local_id_,
manager_, td::Timestamp::in(15.0), std::move(P));
}

void ValidatorGroup::update_approve_cache(CacheKey key, UnixTime value) {
Expand Down Expand Up @@ -421,7 +421,11 @@ void ValidatorGroup::start(std::vector<BlockIdExt> prev, BlockIdExt min_masterch
if (id == local_id_) {
stats.self_idx = idx;
}
stats.nodes.push_back(validatorsession::NewValidatorGroupStats::Node{id, node.weight});
stats.nodes.push_back(validatorsession::NewValidatorGroupStats::Node{
.id = id,
.pubkey = PublicKey(pubkeys::Ed25519(node.key)),
.adnl_id = (node.addr.is_zero() ? adnl::AdnlNodeIdShort{id} : adnl::AdnlNodeIdShort{node.addr}),
.weight = node.weight});
++idx;
}
td::actor::send_closure(manager_, &ValidatorManager::log_new_validator_group_stats, std::move(stats));
Expand Down

0 comments on commit 5ce9d0b

Please sign in to comment.