Skip to content
Merged
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
5 changes: 3 additions & 2 deletions src/blockchain/fork_choice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,11 @@ namespace lean {
outcome::result<void> ForkChoiceStore::onAttestation(
const SignedAttestation &signed_attestation, bool is_from_block) {
// First, ensure the attestation is structurally and temporally valid.
auto source = is_from_block ? "block" : "gossip";
if (auto res = validateAttestation(signed_attestation); res.has_value()) {
metrics_->fc_attestations_valid_total()->inc();
metrics_->fc_attestations_valid_total({{"source", source}})->inc();
} else {
metrics_->fc_attestations_invalid_total()->inc();
metrics_->fc_attestations_invalid_total({{"source", source}})->inc();
return res;
}

Expand Down
14 changes: 8 additions & 6 deletions src/blockchain/fork_choice_metrics.def
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@
METRIC_GAUGE(fc_head_slot, "lean_head_slot", "Latest slot of the beacon chain")

// Attestation validation
METRIC_COUNTER(fc_attestations_valid_total,
"lean_attestations_valid_total",
"Total number of valid attestations")
METRIC_COUNTER(fc_attestations_invalid_total,
"lean_attestations_invalid_total",
"Total number of invalid attestations")
METRIC_COUNTER_LABELS(fc_attestations_valid_total,
"lean_attestations_valid_total",
"Total number of valid attestations",
{"source"})
METRIC_COUNTER_LABELS(fc_attestations_invalid_total,
"lean_attestations_invalid_total",
"Total number of invalid attestations",
{"source"})
METRIC_HISTOGRAM(fc_attestation_validation_time_seconds,
"lean_attestation_validation_time_seconds",
"Time taken to validate attestation",
Expand Down
Loading