-
Notifications
You must be signed in to change notification settings - Fork 105
Add reward information telemetry #209
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
Conversation
WalkthroughBeginBlocker in x/rewards/keeper/abci.go now returns any error from ReleaseSchedule.Set instead of ignoring it. After saving the updated schedule, BeginBlocker calls a new Keeper method WriteRewardMetrics(ctx, distributed, total). WriteRewardMetrics converts amounts to float64 (logs conversion errors) and emits two telemetry gauges: Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)x/rewards/keeper/abci.go (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI Agents
In @x/rewards/keeper/abci.go:
- Around line 79-90: The WriteRewardMetrics function uses
Amount.ToLegacyDec().MustFloat64() and then casts to float32 which risks panic
and precision loss; replace MustFloat64() with ToLegacyDec().Float64() and
handle the returned error (as done in x/feeabstraction/keeper/abci.go): if
Float64() returns an error, log the error via the keeper logger and use a safe
fallback value (e.g., 0) for the telemetry gauge, and only cast to float32 when
passing into telemetry.ModuleSetGauge(types.ModuleName, ...) after confirming a
valid float64 was obtained.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
x/rewards/keeper/abci.go
🧰 Additional context used
🧬 Code graph analysis (1)
x/rewards/keeper/abci.go (2)
x/rewards/keeper/keeper.go (1)
Keeper(18-32)x/rewards/types/keys.go (1)
ModuleName(13-13)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: golangci-lint
- GitHub Check: test-e2e
- GitHub Check: tests
- GitHub Check: liveness-test
- GitHub Check: Analyze
🔇 Additional comments (1)
x/rewards/keeper/abci.go (1)
69-76: LGTM on the error handling refactor.Explicit error handling before emitting telemetry ensures metrics are only recorded after successful state updates.
Description
Adds distributed reward and total distributed to telemetry at begin blocks
Type of change