Skip to content

Remove feegrant module - #3958

Open
masih wants to merge 3 commits into
mainfrom
masih/feegrant-be-gone
Open

Remove feegrant module#3958
masih wants to merge 3 commits into
mainfrom
masih/feegrant-be-gone

Conversation

@masih

@masih masih commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Remove the feegrant module and its keeper, store, CLI, APIs, protobuf definitions, simulation support, and application wiring.

  • Delete the feegrant store during the v6.7 upgrade.
  • Reject transactions specifying a distinct fee granter.
  • Retain the transaction granter field for wire compatibility.
  • Retire precompile 0x1010 with a deterministic revert.
  • Remove feegrant from SeiDB, wasmd, tooling, and Swagger.
  • Preserve historical genesis files unchanged.
  • Regenerate embedded API documentation and update tests.

Remove the feegrant module and its keeper, store, CLI, APIs, protobuf definitions, simulation support, and application wiring.

* Delete the feegrant store during the v6.7 upgrade.
* Reject transactions specifying a distinct fee granter.
* Retain the transaction granter field for wire compatibility.
* Retire precompile 0x1010 with a deterministic revert.
* Remove feegrant from SeiDB, wasmd, tooling, and Swagger.
* Preserve historical genesis files unchanged.
* Regenerate embedded API documentation and update tests.
@github-actions

github-actions Bot commented Aug 19, 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 20, 2026, 4:59 PM

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.04918% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.50%. Comparing base (04f779a) to head (0fa29cb).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
app/ante/cosmos_checktx.go 42.85% 4 Missing ⚠️
app/app.go 76.47% 3 Missing and 1 partial ⚠️
app/upgrades.go 66.66% 1 Missing and 1 partial ⚠️
sei-cosmos/types/tx/types.go 81.81% 1 Missing and 1 partial ⚠️
app/ante/cosmos_delivertx.go 66.66% 0 Missing and 1 partial ⚠️
app/legacyabci/check_tx.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3958      +/-   ##
==========================================
- Coverage   58.61%   57.50%   -1.11%     
==========================================
  Files        2323     2224      -99     
  Lines      198666   186991   -11675     
==========================================
- Hits       116442   107528    -8914     
+ Misses      71469    69627    -1842     
+ Partials    10755     9836     -919     
Flag Coverage Δ
sei-chain-pr 57.45% <77.04%> (?)
sei-db 69.80% <ø> (ø)
sei-db-state-db ?

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

Files with missing lines Coverage Δ
app/ante.go 64.51% <100.00%> (ø)
app/legacyabci/deliver_tx.go 96.05% <100.00%> (ø)
app/precompiles.go 100.00% <ø> (ø)
docs/swagger/statik.go 100.00% <ø> (ø)
giga/executor/precompiles/failfast.go 47.36% <ø> (ø)
precompiles/setup.go 50.45% <ø> (-0.46%) ⬇️
precompiles/utils/expected_keepers.go 100.00% <ø> (ø)
sei-cosmos/client/cmd.go 81.81% <ø> (+2.91%) ⬆️
sei-cosmos/client/context.go 87.74% <ø> (+1.66%) ⬆️
sei-cosmos/client/flags/flags.go 90.00% <ø> (-0.20%) ⬇️
... and 15 more

... and 154 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.

@masih
masih marked this pull request as ready for review August 20, 2026 15:59
@cursor

cursor Bot commented Aug 20, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Deletes a consensus module and its KV store on the v6.7 upgrade, and changes fee deduction so only the payer can pay. Existing grants and feegrant txs will fail after upgrade.

Overview
Removes feegrant as a first-class module: keeper, store, CLI/gRPC/REST, simulation, EVM precompile wiring, and Swagger. Fees are always deducted from the payer.

The v6.7 upgrade deletes the feegrant store and module version. Txs with a fee granter different from the payer are rejected (fee grants are not enabled); the granter field stays on the wire for compatibility. Historical genesis files are left unchanged.

Docs/README no longer advertise fee grants. Ante, CheckTx/DeliverTx, and SeiDB store-key lists are unwired from feegrant.

Reviewed by Cursor Bugbot for commit 0fa29cb. 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, thorough removal of the feegrant module: the fee-granter rejection is correctly placed at a single choke point (Tx.ValidateBasic, reached by both CosmosStatelessChecks and ValidateBasicDecorator), the v6.7 module-version delete is needed because SetModuleVersionMap is additive, and no dangling references remain. No blockers; a few non-blocking notes on flatkv store deletion, ante-level test coverage, historical tx decodability, and the 0x1010 "deterministic revert" claim.

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

Blockers

  • None at the file/PR level.

Non-blocking

  • [suggestion] The new granter rejection is only exercised at the tx.ValidateBasic() level (TestRejectsDistinctFeeGranter). Both fee-deduction sites that previously rejected a distinct granter — DeductFeeDecorator.checkDeductFee and app/ante.chargeFees — now silently deduct from the fee payer when a granter is set, so their safety rests entirely on ValidateBasic running first. An end-to-end case through CosmosCheckTxAnte / CosmosDeliverTxAnte (and note that app/ante.go orders DeductFeeDecorator before NewValidateBasicDecorator) would pin the actual rejection rather than the helper.
  • [suggestion] Dropping feegrantmodule.AppModuleBasic{} from ModuleBasics unregisters cosmos.feegrant.v1beta1 from the interface registry, so historical transactions containing MsgGrantAllowance / MsgRevokeAllowance (feegrant was live on pacific-1) become undecodable by seid q tx, the /cosmos/tx/v1beta1/txs service, and anything else that decodes archived txs. Worth calling out explicitly in the CHANGELOG upgrade guide alongside the CLI/API removals.
  • [suggestion] Removing --fee-account from AddTxFlagsToCmd (sei-cosmos/client/flags/flags.go) makes any existing script that passes it fail with unknown flag rather than a deprecation message. The CHANGELOG covers "CLI ... removal" generically; naming the flag would save operators a bisect.
  • 2 suggestion(s)/nit(s) flagged inline on specific lines.

Comment thread app/app.go

if upgradeInfo.Name == "v6.7" && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Deleted: []string{feegrantModuleName},

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] CompositeCommitStore.ApplyUpgrades (sei-db/state_db/sc/composite/store.go:751) forwards only to memIAVL — its doc comment states "Data in flatKV is not affected by this method" — and returns early when cs.memIAVL == nil. Under the memIAVL-backed modes this deletion works as intended, but for write modes where non-EVM stores have moved to flatkv (MigrateAllButBank, AllMigratedButBank, FlatKVOnly), the feegrant keys survive the upgrade and keep contributing to the flatkv lattice hash.

This is the first store deletion since flatkv landed (the dex/accesscontrol precedents predate it), so it's worth confirming which write modes will be live at the v6.7 height, and whether orphaned feegrant data in flatkv is acceptable or needs an explicit cleanup.

Comment thread precompiles/setup_test.go
func TestFeegrantPrecompileIsNotRegistered(t *testing.T) {
const feegrantAddress = "0x0000000000000000000000000000000000001010"

_, exists := precompiles.GetCustomPrecompiles("v6.7", &utils.EmptyKeepers{})[common.HexToAddress(feegrantAddress)]

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] The PR description says "Retire precompile 0x1010 with a deterministic revert," but nothing implements a revert — 0x1010 simply becomes an unassigned address, so an EVM CALL to it succeeds with empty returndata, and this test only asserts absence from the map rather than call behavior.

Unlike Codex's read of this, I don't think it's blocking: feegrant.GetVersioned registered the precompile only under latestUpgrade, and v6.7 has not activated on any network, so there is no released height at which 0x1010 behaved differently. Either add a tombstone precompile that always reverts and assert the call result, or drop the "deterministic revert" claim from the description so the merge commit matches the code.

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.

not an issue then

@bdchatham

Copy link
Copy Markdown
Contributor

Running xreview locally

Comment thread app/app.go
Comment on lines +1217 to +1219
if upgradeInfo.Name == "v6.7" && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Deleted: []string{feegrantModuleName},

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.

@codchen @masih let's be consistent with how we're remove data with the modules? i think the oracle removal pr doesn't have this

cmd.Flags().String(FlagKeyringBackend, DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test|memory)")
cmd.Flags().String(FlagSignMode, "", "Choose sign mode (direct|amino-json), this is an advanced feature")
cmd.Flags().Uint64(FlagTimeoutHeight, 0, "Set a block timeout height to prevent the tx from being committed past a certain height")
cmd.Flags().String(FlagFeeAccount, "", "Fee account pays fees for the transaction instead of deducting from the signer")

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.


var AllModules = []string{
"evm", "wasm", "oracle", "epoch", "mint", "acc", "bank", "feegrant", "staking", "distribution", "slashing", "gov", "params", "ibc", "upgrade", "evidence", "transfer", "tokenfactory",
"evm", "wasm", "oracle", "epoch", "mint", "acc", "bank", "staking", "distribution", "slashing", "gov", "params", "ibc", "upgrade", "evidence", "transfer", "tokenfactory",

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.

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.

6 participants