Skip to content

fix(x/auth/ante): deduct fees to the decorator's configured recipient module - #26813

Open
kriss39 wants to merge 1 commit into
cosmos:mainfrom
kriss39:fix/ante-fee-recipient-global
Open

kriss39 wants to merge 1 commit into
cosmos:mainfrom
kriss39:fix/ante-fee-recipient-global

Conversation

@kriss39

@kriss39 kriss39 commented Sep 13, 2026

Copy link
Copy Markdown

Description

DeductFeeDecorator deducts fees through the exported DeductFees helper, which sends them to the package-level FeeRecipientModule, and every NewDeductFeeDecorator call reset that global back to fee_collector. The decorator's own feeRecipientModule field (set by WithFeeRecipientModule) was only used for the "module account exists" check, not for the actual transfer.

Any app that constructs more than one DeductFeeDecorator (a second ante chain, a separate chain for a tx type, tests) therefore had a decorator configured via WithFeeRecipientModule silently overridden:

  • decorator configured with poa first, plain decorator second → the poa decorator sends fees to fee_collector. The PoA module turns this into a panic at height 1 (validateFeeRecipient), i.e. the chain cannot start.
  • plain decorator first, poa decorator second → every chain's fees go to poa.

Changes

  • checkDeductFee now deducts to dfd.feeRecipientModule (new unexported deductFeesToModule).
  • NewDeductFeeDecorator no longer resets FeeRecipientModule. The global keeps its fee_collector default and is still updated by WithFeeRecipientModule, so the exported DeductFees helper and the PoA startup check behave as before for correctly configured apps.
  • Regression test TestDeductFees_RecipientNotClobberedByLaterDecorator: constructs a decorator with WithFeeRecipientModule("mint"), then a plain one, and asserts the first still deducts to mint. Fails on main with Unexpected call ... "fee_collector".

x/auth/ante and enterprise/poa tests pass.

@greptile-apps

greptile-apps Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@kriss39
kriss39 force-pushed the fix/ante-fee-recipient-global branch from 0d8cbc0 to 9ad9d88 Compare September 13, 2026 20:12
@kriss39 kriss39 closed this Sep 14, 2026
@kriss39
kriss39 force-pushed the fix/ante-fee-recipient-global branch from 9ad9d88 to 8f265eb Compare September 14, 2026 08:46
… module

DeductFees sent fees to the package-level FeeRecipientModule, and every
NewDeductFeeDecorator call reset that global to fee_collector. An app that
builds more than one ante chain (a common pattern) therefore had the
recipient of a decorator configured with WithFeeRecipientModule silently
overwritten, either sending the fees to fee_collector (which the PoA module
turns into a panic at height 1) or, in the other construction order,
sending every chain's fees to the custom module.

Route the decorator's own deduction through its feeRecipientModule field and
stop resetting the global in the constructor; the global keeps its
fee_collector default and is still updated by WithFeeRecipientModule so the
exported DeductFees helper and the PoA startup check keep working.
@kriss39 kriss39 reopened this Sep 14, 2026
@kriss39

kriss39 commented Sep 14, 2026

Copy link
Copy Markdown
Author

Replaced the commit with a signed one (0a4d4e1, same content) so it shows as Verified; the force-push briefly auto-closed the PR, reopened.

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.

1 participant