Skip to content

Commit d9ad1f5

Browse files
authored
Downgrade duplication log of attestation to Debug (#6007)
* Test * Simplify * summary_opt * Simplify * Test * fix * move to warn * Revise * Downgrade to debug * Add block * Put inside individual tracking
1 parent 4cfdd82 commit d9ad1f5

File tree

1 file changed

+72
-22
lines changed

1 file changed

+72
-22
lines changed

beacon_node/beacon_chain/src/validator_monitor.rs

Lines changed: 72 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,17 +1383,43 @@ impl<E: EthSpec> ValidatorMonitor<E> {
13831383
});
13841384

13851385
if self.individual_tracking() {
1386-
info!(
1387-
self.log,
1388-
"Attestation included in aggregate";
1389-
"head" => ?data.beacon_block_root,
1390-
"index" => %data.index,
1391-
"delay_ms" => %delay.as_millis(),
1392-
"epoch" => %epoch,
1393-
"slot" => %data.slot,
1394-
"src" => src,
1395-
"validator" => %id,
1396-
);
1386+
let is_first_inclusion_aggregate = validator
1387+
.get_from_epoch_summary(epoch, |summary_opt| {
1388+
if let Some(summary) = summary_opt {
1389+
Some(summary.attestation_aggregate_inclusions == 0)
1390+
} else {
1391+
// No data for this validator: no inclusion.
1392+
Some(true)
1393+
}
1394+
})
1395+
.unwrap_or(true);
1396+
1397+
if is_first_inclusion_aggregate {
1398+
info!(
1399+
self.log,
1400+
"Attestation included in aggregate";
1401+
"head" => ?data.beacon_block_root,
1402+
"index" => %data.index,
1403+
"delay_ms" => %delay.as_millis(),
1404+
"epoch" => %epoch,
1405+
"slot" => %data.slot,
1406+
"src" => src,
1407+
"validator" => %id,
1408+
);
1409+
} else {
1410+
// Downgrade to Debug for second and onwards of logging to reduce verbosity
1411+
debug!(
1412+
self.log,
1413+
"Attestation included in aggregate";
1414+
"head" => ?data.beacon_block_root,
1415+
"index" => %data.index,
1416+
"delay_ms" => %delay.as_millis(),
1417+
"epoch" => %epoch,
1418+
"slot" => %data.slot,
1419+
"src" => src,
1420+
"validator" => %id,
1421+
)
1422+
};
13971423
}
13981424

13991425
validator.with_epoch_summary(epoch, |summary| {
@@ -1434,24 +1460,48 @@ impl<E: EthSpec> ValidatorMonitor<E> {
14341460
&["block", label],
14351461
);
14361462
});
1437-
14381463
if self.individual_tracking() {
14391464
metrics::set_int_gauge(
14401465
&metrics::VALIDATOR_MONITOR_ATTESTATION_IN_BLOCK_DELAY_SLOTS,
14411466
&["block", id],
14421467
delay.as_u64() as i64,
14431468
);
14441469

1445-
info!(
1446-
self.log,
1447-
"Attestation included in block";
1448-
"head" => ?data.beacon_block_root,
1449-
"index" => %data.index,
1450-
"inclusion_lag" => format!("{} slot(s)", delay),
1451-
"epoch" => %epoch,
1452-
"slot" => %data.slot,
1453-
"validator" => %id,
1454-
);
1470+
let is_first_inclusion_block = validator
1471+
.get_from_epoch_summary(epoch, |summary_opt| {
1472+
if let Some(summary) = summary_opt {
1473+
Some(summary.attestation_block_inclusions == 0)
1474+
} else {
1475+
// No data for this validator: no inclusion.
1476+
Some(true)
1477+
}
1478+
})
1479+
.unwrap_or(true);
1480+
1481+
if is_first_inclusion_block {
1482+
info!(
1483+
self.log,
1484+
"Attestation included in block";
1485+
"head" => ?data.beacon_block_root,
1486+
"index" => %data.index,
1487+
"inclusion_lag" => format!("{} slot(s)", delay),
1488+
"epoch" => %epoch,
1489+
"slot" => %data.slot,
1490+
"validator" => %id,
1491+
);
1492+
} else {
1493+
// Downgrade to Debug for second and onwards of logging to reduce verbosity
1494+
debug!(
1495+
self.log,
1496+
"Attestation included in block";
1497+
"head" => ?data.beacon_block_root,
1498+
"index" => %data.index,
1499+
"inclusion_lag" => format!("{} slot(s)", delay),
1500+
"epoch" => %epoch,
1501+
"slot" => %data.slot,
1502+
"validator" => %id,
1503+
);
1504+
}
14551505
}
14561506

14571507
validator.with_epoch_summary(epoch, |summary| {

0 commit comments

Comments
 (0)