fix: ensure nativeOracleDenom is whitelisted and exists in voteTargets#303
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
WalkthroughAdds validation to the feeabstraction module's UpdateParams handler to ensure the configured native oracle denom is (1) registered as an oracle vote target and (2) present in the oracle module's whitelist before accepting param updates. Introduces a new GetWhitelist method on the oracle keeper interface and implements it in the oracle keeper. Tests updated to use a cached context, a helper to register oracle targets/whitelist entries, and new negative test cases covering the two failure scenarios. CHANGELOG updated to document the fix. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
🧹 Nitpick comments (1)
x/feeabstraction/keeper/oracle.go (1)
39-42: Clarify disable reason in logs for non-positive base price.Line 39 now correctly handles zero/negative prices, but Line 41 still logs only a “no price” message. That can mislead debugging when the denom exists but price is
0/negative.♻️ Suggested logging refinement
- if !ok || !baseTokenPrice.IsPositive() { - // Disable fee abstraction if there is no pricing - k.Logger(ctx).Debug("%s has no price, feeabstraction disabled", params.NativeOracleDenom) + if !ok || !baseTokenPrice.IsPositive() { + // Disable fee abstraction when pricing is missing or invalid + if !ok { + k.Logger(ctx).Debug("fee abstraction disabled: base token price missing", "denom", params.NativeOracleDenom) + } else { + k.Logger(ctx).Debug("fee abstraction disabled: base token price non-positive", "denom", params.NativeOracleDenom, "price", baseTokenPrice.String()) + } params.Enabled = false return k.Params.Set(ctx, params) }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@x/feeabstraction/keeper/oracle.go` around lines 39 - 42, The debug log incorrectly states "no price" even when baseTokenPrice exists but is zero/negative; update the logging in the block that checks if !ok || !baseTokenPrice.IsPositive() (around baseTokenPrice, params.NativeOracleDenom, params.Enabled) to distinguish the two cases: log "no price" when ok is false, and log a clear message including the actual baseTokenPrice value (and that it's non-positive) when ok is true but baseTokenPrice.IsPositive() is false, then set params.Enabled = false as before.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@x/feeabstraction/keeper/oracle.go`:
- Around line 39-42: The debug log incorrectly states "no price" even when
baseTokenPrice exists but is zero/negative; update the logging in the block that
checks if !ok || !baseTokenPrice.IsPositive() (around baseTokenPrice,
params.NativeOracleDenom, params.Enabled) to distinguish the two cases: log "no
price" when ok is false, and log a clear message including the actual
baseTokenPrice value (and that it's non-positive) when ok is true but
baseTokenPrice.IsPositive() is false, then set params.Enabled = false as before.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 15732fc8-40b9-4aa7-a9c9-3ed1dd5c4281
📒 Files selected for processing (7)
CHANGELOG.mdx/feeabstraction/keeper/msg_server.gox/feeabstraction/keeper/msg_server_test.gox/feeabstraction/keeper/oracle.gox/feeabstraction/keeper/oracle_test.gox/feeabstraction/types/expected_keepers.gox/oracle/keeper/vote_target.go
Co-authored-by: Jhelison Uchoa <68653689+jhelison@users.noreply.github.com>
ea1bb40 to
9643e44
Compare
Description
Fixes:
Type of change
How Has This Been Tested?
Added regression tests
PR Checklist:
Make sure each step was done:
make lint-fix