Skip to content

Deprecate oracle message and query handlers - #3944

Open
codchen wants to merge 4 commits into
mainfrom
agent/deprecate-oracle-handlers
Open

Deprecate oracle message and query handlers#3944
codchen wants to merge 4 commits into
mainfrom
agent/deprecate-oracle-handlers

Conversation

@codchen

@codchen codchen commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • return a registered ErrOracleDeprecated error from both oracle message handlers
  • return the same explicit error from every oracle gRPC query handler
  • remove the oracle module's legacy SDK message and query routes
  • update handler coverage and seed keeper state directly in internal oracle state-machine tests

Why

The oracle module is deprecated, but its Cosmos message and query services still accepted incoming requests. Keeping the gRPC services registered while returning a stable module error gives callers an explicit deprecation result and prevents further oracle message state mutations. The legacy SDK routes are no longer registered.

Impact

Incoming aggregate exchange-rate votes, feeder delegation messages, and oracle queries now fail with oracle error code 25 (oracle module is deprecated). Internal keeper state and state-machine behavior remain available for compatibility and testing.

Validation

  • go test -race ./x/oracle/...
  • go test ./app -run '^$'
  • go vet ./x/oracle/...
  • gofmt, goimports, and git diff --check on all touched files

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedAug 19, 2026, 3:37 AM

@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.49%. Comparing base (46671fb) to head (796d09b).
⚠️ Report is 17 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3944      +/-   ##
==========================================
- Coverage   59.51%   58.49%   -1.02%     
==========================================
  Files        2326     2230      -96     
  Lines      198890   188144   -10746     
==========================================
- Hits       118367   110054    -8313     
+ Misses      69279    67698    -1581     
+ Partials    11244    10392     -852     
Flag Coverage Δ
sei-chain-pr 80.71% <100.00%> (?)
sei-db 70.41% <ø> (ø)
sei-db-state-db ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
x/oracle/keeper/msg_server.go 100.00% <100.00%> (+21.42%) ⬆️
x/oracle/keeper/querier.go 100.00% <100.00%> (+28.23%) ⬆️
x/oracle/module.go 57.50% <100.00%> (-0.53%) ⬇️

... and 97 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codchen
codchen marked this pull request as ready for review August 19, 2026 04:26
@cursor

cursor Bot commented Aug 19, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Breaking change for any client still submitting oracle txs or queries via Cosmos/gRPC/wasm; on-chain keeper and blockers unchanged so downstream apps must handle the new error.

Overview
Oracle Cosmos messages and gRPC queries now fail closed with registered error code 25 (oracle module is deprecated) instead of executing vote/feeder logic or returning keeper data.

The msg server and query server implementations are stubbed to return ErrOracleDeprecated for aggregate votes, feeder delegation, and all query endpoints (params, exchange rates, TWAPs, penalty counters, etc.). Legacy SDK Route and QuerierRoute on the oracle module are cleared so no legacy message/query paths remain registered; gRPC services stay registered for explicit deprecation responses.

Tests and integration coverage are aligned with the new behavior: integration YAML scenarios assert deprecation on set-feeder, aggregate-vote, and CLI queries; wasmbinding oracle custom queries expect ErrOracleDeprecated; EVM precompile tests expect CLI TWAP failure with the deprecation message. Internal ABCI/state-machine tests seed aggregate votes via SetAggregateExchangeRateVote instead of routing through the message handler.

Reviewed by Cursor Bugbot for commit 796d09b. Bugbot is set up for automated code reviews on this repo. Configure here.

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clean, well-scoped deprecation: both oracle msg handlers and all ten gRPC query handlers now return the newly registered ErrOracleDeprecated, legacy SDK routes are dropped (safe — runMsgs prefers the msg service router and RegisterRoutes skips empty routes), and the tests were rewritten to seed keeper state directly. No correctness bugs found; the remaining notes are about deprecation leftovers (gasless carve-out, simulation ops, orphaned NewHandler, repurposed integration files).

Findings: 0 blocking | 7 non-blocking | 2 posted inline

Blockers

  • None at the file/PR level.

Non-blocking

  • The oracle gasless carve-out in app/antedecorators/gasless.go is now permanently open. oracleVoteIsGasless treats a vote as gasless whenever GetAggregateExchangeRateVote finds nothing — and nothing writes an aggregate vote anymore, so the ErrAggregateVoteExist branch is dead and every well-formed MsgAggregateExchangeRateVote is fee-free and then always fails with ErrOracleDeprecated. CheckAndSetSpamPreventionCounter bounds this to one tx per validator per block, so it is not a serious spam vector, but the carve-out now only buys free blockspace for a message that can never succeed. Consider dropping the oracle branch from IsTxGasless (and the now-vestigial SpammingPreventionDecorator / VoteAloneDecorator) in the same change.
  • Callers do not uniformly get the deprecation error the PR describes. GaslessDecorator propagates the IsTxGasless error, so a vote from a non-feeder is rejected in ante with ErrNoVotingPermission/ErrNoValidatorFound before reaching the msg server, and SpammingPreventionDecorator.CheckOracleSpamming still writes the spam-prevention counter (mem store) on CheckTx for every incoming vote. Worth aligning if "explicit deprecation result" is the goal.
  • x/oracle/simulation/operations.go still returns weighted operations for MsgAggregateExchangeRateVote and MsgDelegateFeedConsent, and AppModule.WeightedOperations still wires them in. Both call app.Deliver, which now returns ErrOracleDeprecated, so the operation returns a non-nil error and any simulation run fails. These operations should return no-ops (or WeightedOperations should return nil) alongside the handler deprecation.
  • Both oracle integration files were repurposed into near-duplicate deprecation checks (set_feeder_test.yaml for msgs, verify_penalty_counts.yaml for queries) while MidBlocker/EndBlocker still run penalty accounting and SlashAndResetCounters on chain. That end-to-end path now has no integration coverage. Slashing is inert today only because DefaultSlashFraction/DefaultMinValidPerWindow are zero — worth a note in the PR description that the deprecation relies on that.
  • 2 suggestion(s)/nit(s) flagged inline on specific lines.
  • 1 non-blocking pre-existing issue(s) listed below under pre-existing issues.

Pre-existing issues

  • [suggestion] x/oracle/client/rest/query.go builds legacy custom/oracle/... queries, but AppModule.LegacyQuerierHandler already returned nil on the base branch, so those REST endpoints were registered against a nil querier and were already non-functional. This PR makes them fail cleanly instead of nil-panicking; RegisterRESTRoutes could be dropped entirely as follow-up.

Comment thread x/oracle/module.go
return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper))
}
// Route returns an empty legacy message route.
func (AppModule) Route() sdk.Route { return sdk.Route{} }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[suggestion] With the route removed, oracle.NewHandler in x/oracle/handler.go no longer has any production caller — its only remaining references are handler_test.go (and types.RouterKey is now unreferenced too). That leaves exported production code alive solely to satisfy tests, and module_test.go/TestOracleHandlerRejectsUnknownMessage then assert against a code path nothing routes to. Either delete NewHandler + RouterKey and drop the handler tests, or keep the route wired — the half-state is the part that will confuse the next reader.

@@ -1,45 +1,13 @@
- name: Test penalty counts for oracle process
- name: Test oracle queries are deprecated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[suggestion] This file is now named verify_penalty_counts but verifies query deprecation, which makes it a near-duplicate of set_feeder_test.yaml's new content and leaves nothing covering the penalty-counter/end-blocker path it used to exercise. Suggest renaming it (e.g. queries_deprecated.yaml) or folding both checks into one file, so the filename still tells you what broke when it fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant