Skip to content

Commit 921aa29

Browse files
authored
create complaints for master vals only for masterchain blocks (#1231)
1 parent 1bef6df commit 921aa29

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lite-client/lite-client.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3657,7 +3657,7 @@ void TestNode::continue_check_validator_load3(std::unique_ptr<TestNode::Validato
36573657
std::unique_ptr<TestNode::ValidatorLoadInfo> info2, int mode,
36583658
std::string file_pfx) {
36593659
LOG(INFO) << "continue_check_validator_load3 for blocks " << info1->blk_id.to_str() << " and "
3660-
<< info1->blk_id.to_str() << " with mode=" << mode << " and file prefix `" << file_pfx
3660+
<< info2->blk_id.to_str() << " with mode=" << mode << " and file prefix `" << file_pfx
36613661
<< "`: comparing block creators data";
36623662
if (info1->created_total.first <= 0 || info2->created_total.first <= 0) {
36633663
LOG(ERROR) << "no total created blocks statistics";
@@ -3718,13 +3718,14 @@ void TestNode::continue_check_validator_load3(std::unique_ptr<TestNode::Validato
37183718
block::MtCarloComputeShare shard_share(shard_count, info2->vset->export_scaled_validator_weights());
37193719
for (int i = 0; i < count; i++) {
37203720
int x1 = d[i].first, y1 = d[i].second;
3721-
double xe = (i < main_count ? (double)xs / main_count : 0);
3721+
bool is_masterchain_validator = i < main_count;
3722+
double xe = (is_masterchain_validator ? (double)xs / main_count : 0);
37223723
double ye = shard_share[i] * (double)ys / shard_count;
37233724
td::Bits256 pk = info2->vset->list[i].pubkey.as_bits256();
37243725
double p1 = create_prob(x1, .9 * xe), p2 = shard_create_prob(y1, .9 * ye, chunk_size);
37253726
td::TerminalIO::out() << "val #" << i << ": pubkey " << pk.to_hex() << ", blocks created (" << x1 << "," << y1
37263727
<< "), expected (" << xe << "," << ye << "), probabilities " << p1 << " and " << p2 << "\n";
3727-
if (std::min(p1, p2) < .00001) {
3728+
if ((is_masterchain_validator ? p1 : p2) < .00001) {
37283729
LOG(ERROR) << "validator #" << i << " with pubkey " << pk.to_hex()
37293730
<< " : serious misbehavior detected: created less than 90% of the expected amount of blocks with "
37303731
"probability 99.999% : created ("
@@ -3737,7 +3738,7 @@ void TestNode::continue_check_validator_load3(std::unique_ptr<TestNode::Validato
37373738
cnt_ok++;
37383739
}
37393740
}
3740-
} else if (std::min(p1, p2) < .005) {
3741+
} else if ((is_masterchain_validator ? p1 : p2) < .005) {
37413742
LOG(ERROR) << "validator #" << i << " with pubkey " << pk.to_hex()
37423743
<< " : moderate misbehavior detected: created less than 90% of the expected amount of blocks with "
37433744
"probability 99.5% : created ("

0 commit comments

Comments
 (0)