Skip to content

Commit

Permalink
fix(halo/evmstaking2): improve delivered events metric (#2655)
Browse files Browse the repository at this point in the history
- changes the delivered events metric to only go up if at least one
event was delivered
- adds a new interval for staging for easier testing

issue: #2525
  • Loading branch information
chmllr authored Dec 9, 2024
1 parent e75c450 commit 7597a06
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 8 additions & 2 deletions halo/app/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ const (
genesisTrimLag uint64 = 1 // Allow deleting attestations in block after approval.
genesisCTrimLag uint64 = 72_000 // Delete consensus attestations state after +-1 day (given a period of 1.2s).

deliverIntervalProtected = 20_000 // Roughly ~12h assumping 0.5bps
deliverIntervalEphemeral = 2 // Fast updates while testing
deliverIntervalProtected = 20_000 // Roughly ~12h assuming 0.5bps
// TODO(christian): remove after testing.
deliverIntervalStaging = 300 // Roughly ~10m assuming 0.5bps
deliverIntervalEphemeral = 2 // Fast updates while testing
)

//nolint:gochecknoglobals // Cosmos-style
Expand Down Expand Up @@ -245,6 +247,10 @@ var (
)

func deliverInterval(network netconf.ID) int64 {
if network == netconf.Staging {
return deliverIntervalStaging
}

if network.IsProtected() {
return deliverIntervalProtected
}
Expand Down
7 changes: 6 additions & 1 deletion halo/evmstaking2/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func (k *Keeper) EndBlock(ctx context.Context) error {
}
defer iter.Close()

delivered := false
for iter.Next() {
val, err := iter.Value()
if err != nil {
Expand All @@ -108,8 +109,12 @@ func (k *Keeper) EndBlock(ctx context.Context) error {
if err != nil {
return errors.Wrap(err, "delete evm event")
}
delivered = true
}
eventDeliveries.Inc()
if delivered {
eventDeliveries.Inc()
}

bufferedEvents.Set(0)

return nil
Expand Down

0 comments on commit 7597a06

Please sign in to comment.