-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: integrate feeabs #175
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,10 +1,12 @@ | ||||||
package app | ||||||
|
||||||
import ( | ||||||
"errors" | ||||||
|
||||||
ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" | ||||||
"github.com/cosmos/ibc-go/v8/modules/core/keeper" | ||||||
feeabsante "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/ante" | ||||||
feeabskeeper "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/keeper" | ||||||
|
||||||
corestoretypes "cosmossdk.io/core/store" | ||||||
circuitante "cosmossdk.io/x/circuit/ante" | ||||||
|
@@ -27,6 +29,7 @@ | |||||
WasmKeeper *wasmkeeper.Keeper | ||||||
TXCounterStoreService corestoretypes.KVStoreService | ||||||
CircuitKeeper *circuitkeeper.Keeper | ||||||
FeeAbskeeper feeabskeeper.Keeper | ||||||
} | ||||||
|
||||||
// NewAnteHandler constructor | ||||||
|
@@ -57,11 +60,13 @@ | |||||
wasmkeeper.NewGasRegisterDecorator(options.WasmKeeper.GetGasRegister()), | ||||||
circuitante.NewCircuitBreakerDecorator(options.CircuitKeeper), | ||||||
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), | ||||||
feeabsante.NewFeeAbstrationMempoolFeeDecorator(options.FeeAbskeeper), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a typographical error in the decorator function name - feeabsante.NewFeeAbstrationMempoolFeeDecorator(options.FeeAbskeeper),
+ feeabsante.NewFeeAbstractionMempoolFeeDecorator(options.FeeAbskeeper), Committable suggestion
Suggested change
|
||||||
|
||||||
ante.NewValidateBasicDecorator(), | ||||||
ante.NewTxTimeoutHeightDecorator(), | ||||||
ante.NewValidateMemoDecorator(options.AccountKeeper), | ||||||
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), | ||||||
feeabsante.NewFeeAbstractionDeductFeeDecorate(options.AccountKeeper, options.BankKeeper, options.FeeAbskeeper, options.FeegrantKeeper), | ||||||
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker), | ||||||
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators | ||||||
ante.NewValidateSigCountDecorator(options.AccountKeeper), | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -44,6 +44,9 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" | ||||||||||||||||||||||||||||||||||||||||||||||||||
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" | ||||||||||||||||||||||||||||||||||||||||||||||||||
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" | ||||||||||||||||||||||||||||||||||||||||||||||||||
feeabsmodule "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs" | ||||||||||||||||||||||||||||||||||||||||||||||||||
feeabskeeper "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/keeper" | ||||||||||||||||||||||||||||||||||||||||||||||||||
feeabstypes "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/types" | ||||||||||||||||||||||||||||||||||||||||||||||||||
"github.com/osmosis-labs/tokenfactory" | ||||||||||||||||||||||||||||||||||||||||||||||||||
"github.com/osmosis-labs/tokenfactory/bindings" | ||||||||||||||||||||||||||||||||||||||||||||||||||
tokenfactorykeeper "github.com/osmosis-labs/tokenfactory/keeper" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -202,6 +205,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
alliancemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
alliancemoduletypes.RewardsPoolName: nil, | ||||||||||||||||||||||||||||||||||||||||||||||||||
feeabstypes.ModuleName: nil, | ||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
var ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -241,6 +245,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
NFTKeeper nftkeeper.Keeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
ConsensusParamsKeeper consensusparamkeeper.Keeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
CircuitKeeper circuitkeeper.Keeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
FeeabsKeeper feeabskeeper.Keeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly | ||||||||||||||||||||||||||||||||||||||||||||||||||
IBCFeeKeeper ibcfeekeeper.Keeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -259,6 +264,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
ScopedTransferKeeper capabilitykeeper.ScopedKeeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
ScopedIBCFeeKeeper capabilitykeeper.ScopedKeeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
ScopedWasmKeeper capabilitykeeper.ScopedKeeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
ScopedFeeabsKeeper capabilitykeeper.ScopedKeeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
TokenFactoryKeeper tokenfactorykeeper.Keeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -326,6 +332,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
icacontrollertypes.StoreKey, tokenfactorytypes.StoreKey, | ||||||||||||||||||||||||||||||||||||||||||||||||||
ibchookstypes.StoreKey, | ||||||||||||||||||||||||||||||||||||||||||||||||||
alliancemoduletypes.StoreKey, | ||||||||||||||||||||||||||||||||||||||||||||||||||
feeabstypes.StoreKey, | ||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -377,7 +384,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) | ||||||||||||||||||||||||||||||||||||||||||||||||||
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) | ||||||||||||||||||||||||||||||||||||||||||||||||||
scopedWasmKeeper := app.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
scopedFeeabsKeeper := app.CapabilityKeeper.ScopeToModule(feeabstypes.ModuleName) | ||||||||||||||||||||||||||||||||||||||||||||||||||
// add keepers | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
app.AccountKeeper = authkeeper.NewAccountKeeper( | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -558,7 +565,8 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
// See: https://docs.cosmos.network/main/modules/gov#proposal-messages | ||||||||||||||||||||||||||||||||||||||||||||||||||
govRouter := govv1beta1.NewRouter() | ||||||||||||||||||||||||||||||||||||||||||||||||||
govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). | ||||||||||||||||||||||||||||||||||||||||||||||||||
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).AddRoute(alliancemoduletypes.RouterKey, alliancemodule.NewAllianceProposalHandler(app.AllianceKeeper)) | ||||||||||||||||||||||||||||||||||||||||||||||||||
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).AddRoute(alliancemoduletypes.RouterKey, alliancemodule.NewAllianceProposalHandler(app.AllianceKeeper)). | ||||||||||||||||||||||||||||||||||||||||||||||||||
AddRoute(feeabstypes.RouterKey, feeabsmodule.NewHostZoneProposal(app.FeeabsKeeper)) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
govConfig := govtypes.DefaultConfig() | ||||||||||||||||||||||||||||||||||||||||||||||||||
/* | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -605,6 +613,20 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
// If evidence needs to be handled for the app, set routes in router here and seal | ||||||||||||||||||||||||||||||||||||||||||||||||||
app.EvidenceKeeper = *evidenceKeeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
app.FeeabsKeeper = feeabskeeper.NewKeeper( | ||||||||||||||||||||||||||||||||||||||||||||||||||
appCodec, | ||||||||||||||||||||||||||||||||||||||||||||||||||
app.keys[feeabstypes.StoreKey], | ||||||||||||||||||||||||||||||||||||||||||||||||||
app.GetSubspace(feeabstypes.ModuleName), | ||||||||||||||||||||||||||||||||||||||||||||||||||
&app.StakingKeeper, | ||||||||||||||||||||||||||||||||||||||||||||||||||
app.AccountKeeper, | ||||||||||||||||||||||||||||||||||||||||||||||||||
app.BankKeeper, | ||||||||||||||||||||||||||||||||||||||||||||||||||
Check failure on line 622 in app/app.go
|
||||||||||||||||||||||||||||||||||||||||||||||||||
app.TransferKeeper, | ||||||||||||||||||||||||||||||||||||||||||||||||||
app.IBCKeeper.ChannelKeeper, | ||||||||||||||||||||||||||||||||||||||||||||||||||
app.IBCKeeper.PortKeeper, | ||||||||||||||||||||||||||||||||||||||||||||||||||
app.ScopedFeeabsKeeper, | ||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The instantiation of the - app.BankKeeper,
+ app.BankKeeper.BaseKeeper, Ensure to pass the Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
feeabsIBCModule := feeabsmodule.NewIBCModule(appCodec, app.FeeabsKeeper) | ||||||||||||||||||||||||||||||||||||||||||||||||||
// Create Interchain Accounts Stack | ||||||||||||||||||||||||||||||||||||||||||||||||||
// SendPacket, since it is originating from the application to core IBC: | ||||||||||||||||||||||||||||||||||||||||||||||||||
// icaAuthModuleKeeper.SendTx -> icaController.SendPacket -> fee.SendPacket -> channel.SendPacket | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -637,6 +659,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
AddRoute(wasmtypes.ModuleName, wasmStack). | ||||||||||||||||||||||||||||||||||||||||||||||||||
AddRoute(icacontrollertypes.SubModuleName, icaControllerStack). | ||||||||||||||||||||||||||||||||||||||||||||||||||
AddRoute(icahosttypes.SubModuleName, icaHostStack) | ||||||||||||||||||||||||||||||||||||||||||||||||||
AddRoute(feeabstypes.ModuleName, feeabsIBCModule) | ||||||||||||||||||||||||||||||||||||||||||||||||||
Check failure on line 662 in app/app.go
|
||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's an issue with the Please verify the correct method to add a route for the fee abstraction module to the IBC router. It's possible that the method name or the way routes are added to the router has changed or needs to be implemented. |
||||||||||||||||||||||||||||||||||||||||||||||||||
app.IBCKeeper.SetRouter(ibcRouter) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
app.IBCHooksKeeper = ibchookskeeper.NewKeeper( | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -764,6 +787,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
// sdk | ||||||||||||||||||||||||||||||||||||||||||||||||||
crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them, | ||||||||||||||||||||||||||||||||||||||||||||||||||
tokenfactory.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(tokenfactorytypes.ModuleName)), | ||||||||||||||||||||||||||||||||||||||||||||||||||
feeabsmodule.NewAppModule(appCodec, app.FeeabsKeeper), | ||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
// BasicModuleManager defines the module BasicManager is in charge of setting up basic, | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -777,6 +801,9 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
govtypes.ModuleName: gov.NewAppModuleBasic( | ||||||||||||||||||||||||||||||||||||||||||||||||||
[]govclient.ProposalHandler{ | ||||||||||||||||||||||||||||||||||||||||||||||||||
paramsclient.ProposalHandler, | ||||||||||||||||||||||||||||||||||||||||||||||||||
feeabsmodule.UpdateAddHostZoneClientProposalHandler, | ||||||||||||||||||||||||||||||||||||||||||||||||||
feeabsmodule.UpdateDeleteHostZoneClientProposalHandler, | ||||||||||||||||||||||||||||||||||||||||||||||||||
feeabsmodule.UpdateSetHostZoneClientProposalHandler, | ||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||||||||||||||||
alliancemoduletypes.ModuleName: alliancemodule.AppModuleBasic{}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -816,6 +843,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
wasmtypes.ModuleName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
tokenfactorytypes.ModuleName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
alliancemoduletypes.ModuleName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
feeabstypes.ModuleName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
app.ModuleManager.SetOrderEndBlockers( | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -834,7 +862,9 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
ibchookstypes.ModuleName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
wasm08types.ModuleName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
wasmtypes.ModuleName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
tokenfactorytypes.ModuleName, alliancemoduletypes.ModuleName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
tokenfactorytypes.ModuleName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
alliancemoduletypes.ModuleName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
feeabstypes.ModuleName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
// NOTE: The genutils module must occur after staking so that pools are | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -880,6 +910,8 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
wasmtypes.ModuleName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
tokenfactorytypes.ModuleName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
alliancemoduletypes.ModuleName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
feeabstypes.ModuleName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||
app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) | ||||||||||||||||||||||||||||||||||||||||||||||||||
app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -950,6 +982,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
app.ScopedWasmKeeper = scopedWasmKeeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
app.ScopedICAHostKeeper = scopedICAHostKeeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
app.ScopedICAControllerKeeper = scopedICAControllerKeeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
app.ScopedFeeabsKeeper = scopedFeeabsKeeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
app.setPostHandler() | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -1272,6 +1305,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
paramsKeeper.Subspace(tokenfactorytypes.ModuleName).WithKeyTable(tokenfactorytypes.ParamKeyTable()) | ||||||||||||||||||||||||||||||||||||||||||||||||||
paramsKeeper.Subspace(wasmtypes.ModuleName) | ||||||||||||||||||||||||||||||||||||||||||||||||||
paramsKeeper.Subspace(alliancemoduletypes.ModuleName) | ||||||||||||||||||||||||||||||||||||||||||||||||||
paramsKeeper.Subspace(feeabstypes.ModuleName) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
return paramsKeeper | ||||||||||||||||||||||||||||||||||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The verification process confirms that both
feeabsante
andfeeabskeeper
dependencies are missing from thego.sum
file. It's recommended to rungo mod tidy
to update thego.sum
file accordingly and avoid potential build failures.Analysis chain
The imports for
feeabsante
andfeeabskeeper
are correctly added to integrate fee abstraction functionalities. However, ensure that thego.sum
file is updated with these dependencies to avoid build failures. Runninggo mod tidy
should address this.Scripts Executed
The following scripts were executed for the analysis:
Script:
Length of output: 319
The import statements are not organized according to Go conventions, which recommend grouping and ordering imports for better readability. Consider using a tool like
gci
to automatically format the import statements.Committable suggestion