Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge queue: embarking unstable (5f053b0) and #6545 together #6586

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions beacon_node/beacon_chain/src/light_client_server_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ impl<T: BeaconChainTypes> LightClientServerCache<T> {
log: &Logger,
chain_spec: &ChainSpec,
) -> Result<(), BeaconChainError> {
metrics::inc_counter(&metrics::LIGHT_CLIENT_SERVER_CACHE_PROCESSING_REQUESTS);
let _timer =
metrics::start_timer(&metrics::LIGHT_CLIENT_SERVER_CACHE_RECOMPUTE_UPDATES_TIMES);

Expand Down Expand Up @@ -205,6 +206,7 @@ impl<T: BeaconChainTypes> LightClientServerCache<T> {
*self.latest_light_client_update.write() = Some(new_light_client_update);
}

metrics::inc_counter(&metrics::LIGHT_CLIENT_SERVER_CACHE_PROCESSING_SUCCESSES);
Ok(())
}

Expand Down Expand Up @@ -280,6 +282,11 @@ impl<T: BeaconChainTypes> LightClientServerCache<T> {
let (sync_committee_bytes, light_client_update_bytes) = res?;
let sync_committee_period = u64::from_ssz_bytes(&sync_committee_bytes)
.map_err(store::errors::Error::SszDecodeError)?;

if sync_committee_period >= start_period + count {
break;
}

let epoch = sync_committee_period
.safe_mul(chain_spec.epochs_per_sync_committee_period.into())?;

Expand All @@ -290,10 +297,6 @@ impl<T: BeaconChainTypes> LightClientServerCache<T> {
.map_err(store::errors::Error::SszDecodeError)?;

light_client_updates.push(light_client_update);

if sync_committee_period >= start_period + count {
break;
}
}
Ok(light_client_updates)
}
Expand Down
16 changes: 16 additions & 0 deletions beacon_node/beacon_chain/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1972,6 +1972,22 @@ pub static LIGHT_CLIENT_SERVER_CACHE_PREV_BLOCK_CACHE_MISS: LazyLock<Result<IntC
)
});

pub static LIGHT_CLIENT_SERVER_CACHE_PROCESSING_REQUESTS: LazyLock<Result<IntCounter>> =
LazyLock::new(|| {
try_create_int_counter(
"beacon_light_client_server_cache_processing_requests",
"Count of all requests to recompute and cache updates",
)
});

pub static LIGHT_CLIENT_SERVER_CACHE_PROCESSING_SUCCESSES: LazyLock<Result<IntCounter>> =
LazyLock::new(|| {
try_create_int_counter(
"beacon_light_client_server_cache_processing_successes",
"Count of all successful requests to recompute and cache updates",
)
});

/// Scrape the `beacon_chain` for metrics that are not constantly updated (e.g., the present slot,
/// head state info, etc) and update the Prometheus `DEFAULT_REGISTRY`.
pub fn scrape_for_metrics<T: BeaconChainTypes>(beacon_chain: &BeaconChain<T>) {
Expand Down
Loading