diff --git a/pkg/cache.go b/pkg/cache.go index ba18a8e..83dd835 100644 --- a/pkg/cache.go +++ b/pkg/cache.go @@ -68,7 +68,7 @@ func SaveCache(newCache *LocalCache) { tmpfile, err := os.CreateTemp("", "stakefish-eth2-monitor-cache.*.json") if err != nil { - log.Debug().Err(err).Msg("SaveCache: os.Open failed; skip") + log.Warn().Err(err).Msg("SaveCache: os.CreateTemp failed; skip") return } defer os.Remove(tmpfile.Name()) diff --git a/pkg/monitoring.go b/pkg/monitoring.go index 6b997b5..5814de5 100644 --- a/pkg/monitoring.go +++ b/pkg/monitoring.go @@ -353,6 +353,7 @@ func MonitorAttestationsAndProposals(ctx context.Context, beacon *beaconchain.Be }) prometheus.MustRegister(totalDelayedAttestationsOverToleranceCounter) + // https://www.attestant.io/posts/defining-attestation-effectiveness/ canonicalAttestationDistances := prometheus.NewHistogram(prometheus.HistogramOpts{ Namespace: "ETH2", Name: "canonicalAttestationDistances", @@ -477,9 +478,11 @@ func MonitorAttestationsAndProposals(ctx context.Context, beacon *beaconchain.Be continue } - attestationDistance := blockSlot - phase0.Slot(attestedSlot) - // Take skipped slots into account - for s := attestedSlot; s < uint64(blockSlot); s++ { + // https://www.attestant.io/posts/defining-attestation-effectiveness/ + earliestInclusionSlot := attestedSlot + 1 + attestationDistance := blockSlot - phase0.Slot(earliestInclusionSlot) + // Do not penalize validator for skipped slots + for s := earliestInclusionSlot; s < uint64(blockSlot); s++ { if _, ok := epochBlocks[s]; !ok { attestationDistance-- }