From 688fbe7dbebfcf0988734b64681c8a757d9f8b03 Mon Sep 17 00:00:00 2001 From: tim gretler Date: Wed, 5 Oct 2022 22:28:36 +0200 Subject: [PATCH 1/5] count blcoks --- .../beacon_chain/src/validator_monitor.rs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/beacon_node/beacon_chain/src/validator_monitor.rs b/beacon_node/beacon_chain/src/validator_monitor.rs index 06734d3e6e8..7eed68c936d 100644 --- a/beacon_node/beacon_chain/src/validator_monitor.rs +++ b/beacon_node/beacon_chain/src/validator_monitor.rs @@ -109,6 +109,11 @@ impl EpochSummary { } } + pub fn register_block(&mut self, delay: Duration) { + self.blocks += 1; + Self::update_if_lt(&mut self.block_min_delay, delay); + } + pub fn register_unaggregated_attestation(&mut self, delay: Duration) { self.attestations += 1; Self::update_if_lt(&mut self.attestation_min_delay, delay); @@ -625,13 +630,6 @@ impl ValidatorMonitor { Ok(()) } - fn get_validator_id(&self, validator_index: u64) -> Option<&str> { - self.indices - .get(&validator_index) - .and_then(|pubkey| self.validators.get(pubkey)) - .map(|validator| validator.id.as_str()) - } - fn get_validator(&self, validator_index: u64) -> Option<&MonitoredValidator> { self.indices .get(&validator_index) @@ -697,7 +695,9 @@ impl ValidatorMonitor { block_root: Hash256, slot_clock: &S, ) { - if let Some(id) = self.get_validator_id(block.proposer_index()) { + let epoch = block.slot().epoch(T::slots_per_epoch()); + if let Some(validator) = self.get_validator(block.proposer_index()) { + let id = &validator.id; let delay = get_block_delay_ms(seen_timestamp, block, slot_clock); metrics::inc_counter_vec(&metrics::VALIDATOR_MONITOR_BEACON_BLOCK_TOTAL, &[src, id]); @@ -716,6 +716,10 @@ impl ValidatorMonitor { "src" => src, "validator" => %id, ); + + validator.with_epoch_summary(epoch, |summary| { + summary.register_aggregated_attestation(delay) + }); } } From fbabcb95d41de29a255d88e43a385887a020423c Mon Sep 17 00:00:00 2001 From: tim gretler Date: Sat, 8 Oct 2022 14:48:08 +0200 Subject: [PATCH 2/5] observe blokcs --- beacon_node/beacon_chain/src/validator_monitor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beacon_node/beacon_chain/src/validator_monitor.rs b/beacon_node/beacon_chain/src/validator_monitor.rs index 7eed68c936d..44bc967b4a1 100644 --- a/beacon_node/beacon_chain/src/validator_monitor.rs +++ b/beacon_node/beacon_chain/src/validator_monitor.rs @@ -1,4 +1,4 @@ -//! Provides detailed logging and metrics for a set of registered validators. +/! Provides detailed logging and metrics for a set of registered validators. //! //! This component should not affect consensus. @@ -718,7 +718,7 @@ impl ValidatorMonitor { ); validator.with_epoch_summary(epoch, |summary| { - summary.register_aggregated_attestation(delay) + summary.register_block(delay) }); } } From d5a8c2e36c7394e1889d372c22fd6d9436b1ae35 Mon Sep 17 00:00:00 2001 From: tim gretler Date: Sat, 8 Oct 2022 14:50:15 +0200 Subject: [PATCH 3/5] missing / --- beacon_node/beacon_chain/src/validator_monitor.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/beacon_node/beacon_chain/src/validator_monitor.rs b/beacon_node/beacon_chain/src/validator_monitor.rs index 44bc967b4a1..bfac3840956 100644 --- a/beacon_node/beacon_chain/src/validator_monitor.rs +++ b/beacon_node/beacon_chain/src/validator_monitor.rs @@ -1,4 +1,4 @@ -/! Provides detailed logging and metrics for a set of registered validators. +//! Provides detailed logging and metrics for a set of registered validators. //! //! This component should not affect consensus. @@ -717,9 +717,7 @@ impl ValidatorMonitor { "validator" => %id, ); - validator.with_epoch_summary(epoch, |summary| { - summary.register_block(delay) - }); + validator.with_epoch_summary(epoch, |summary| summary.register_block(delay)); } } From b590a42f6af8cfc758b08567d295ffe87137b7ca Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Wed, 9 Nov 2022 15:18:15 +1100 Subject: [PATCH 4/5] No-op commit to re-run CI --- beacon_node/beacon_chain/src/validator_monitor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beacon_node/beacon_chain/src/validator_monitor.rs b/beacon_node/beacon_chain/src/validator_monitor.rs index bfac3840956..6063bf0e98b 100644 --- a/beacon_node/beacon_chain/src/validator_monitor.rs +++ b/beacon_node/beacon_chain/src/validator_monitor.rs @@ -717,7 +717,7 @@ impl ValidatorMonitor { "validator" => %id, ); - validator.with_epoch_summary(epoch, |summary| summary.register_block(delay)); + validator.with_epoch_summary(epoch, |epoch_summary| epoch_summary.register_block(delay)); } } From fc311c7c87b557c1c91d24124c8d419165ddd3cf Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Wed, 9 Nov 2022 15:27:59 +1100 Subject: [PATCH 5/5] Another no-op commit to revert the previous one --- beacon_node/beacon_chain/src/validator_monitor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beacon_node/beacon_chain/src/validator_monitor.rs b/beacon_node/beacon_chain/src/validator_monitor.rs index 6063bf0e98b..bfac3840956 100644 --- a/beacon_node/beacon_chain/src/validator_monitor.rs +++ b/beacon_node/beacon_chain/src/validator_monitor.rs @@ -717,7 +717,7 @@ impl ValidatorMonitor { "validator" => %id, ); - validator.with_epoch_summary(epoch, |epoch_summary| epoch_summary.register_block(delay)); + validator.with_epoch_summary(epoch, |summary| summary.register_block(delay)); } }