Skip to content

fix: ensure nativeOracleDenom is whitelisted and exists in voteTargets#303

Merged
Thaleszh merged 5 commits into
mainfrom
fix/oracle-denom
Apr 1, 2026
Merged

fix: ensure nativeOracleDenom is whitelisted and exists in voteTargets#303
Thaleszh merged 5 commits into
mainfrom
fix/oracle-denom

Conversation

@Thaleszh

@Thaleszh Thaleszh commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes:

  • Ensure nativeOracleDenom is whitelisted and exists in voteTargets

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Added regression tests

PR Checklist:

Make sure each step was done:

  • Updated changelog with PR's intent
  • Lint with make lint-fix

@Thaleszh Thaleszh requested a review from jhelison as a code owner March 31, 2026 15:56
@coderabbitai

coderabbitai Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ab3c2ac8-9139-4605-ab82-b04da307e6aa

📥 Commits

Reviewing files that changed from the base of the PR and between 9643e44 and 2ca4a8a.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • x/feeabstraction/keeper/msg_server.go
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

Walkthrough

Adds 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)
Check name Status Explanation
Title check ✅ Passed The pull request title 'fix: ensure nativeOracleDenom is whitelisted and exists in voteTargets' clearly and specifically describes the main change - adding validation to ensure the native oracle denomination is both whitelisted and registered as a vote target.
Description check ✅ Passed The pull request description is directly related to the changeset, explaining the bug fix being implemented (ensuring nativeOracleDenom is whitelisted and exists in voteTargets), noting it as a non-breaking bug fix, and confirming that regression tests were added.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/oracle-denom

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Mar 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 22 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
x/feeabstraction/keeper/msg_server.go 0.00% 17 Missing ⚠️
x/oracle/keeper/vote_target.go 0.00% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2c96c69 and 1c7d51a.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • x/feeabstraction/keeper/msg_server.go
  • x/feeabstraction/keeper/msg_server_test.go
  • x/feeabstraction/keeper/oracle.go
  • x/feeabstraction/keeper/oracle_test.go
  • x/feeabstraction/types/expected_keepers.go
  • x/oracle/keeper/vote_target.go

Comment thread x/feeabstraction/keeper/msg_server.go Outdated
@Thaleszh Thaleszh changed the title fix: disable fee abstraction if base token price is 0 & ensure nativeOracleDenom is whitelisted and exists in voteTargets fix: ensure nativeOracleDenom is whitelisted and exists in voteTargets Apr 1, 2026
@Thaleszh Thaleszh merged commit 46bf6ed into main Apr 1, 2026
9 of 10 checks passed
@Thaleszh Thaleszh deleted the fix/oracle-denom branch April 1, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants