Skip to content
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

Fix: Deduct TX fees #442

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ type HandlerOptions struct {
IBCKeeper *ibckeeper.Keeper
BankKeeper bankkeeper.Keeper
TxCounterStoreKey storetypes.StoreKey
WasmConfig wasmtypes.WasmConfig
WasmConfig *wasmtypes.WasmConfig
WasmKeeper *wasmkeeper.Keeper
Cdc codec.BinaryCodec

StakingKeeper stakingkeeper.Keeper
Expand All @@ -50,6 +51,10 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
}

if options.WasmConfig == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "wasm config is required for ante builder")
}

sigGasConsumer := options.SigGasConsumer
if sigGasConsumer == nil {
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
Expand All @@ -60,11 +65,13 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit),
wasmkeeper.NewCountTXDecorator(options.TxCounterStoreKey),
wasmkeeper.NewGasRegisterDecorator(options.WasmKeeper.GetGasRegister()),
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),

// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
Expand Down
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ func NewSgeApp(
IBCKeeper: app.AppKeepers.IBCKeeper,
BankKeeper: app.AppKeepers.BankKeeper,
TxCounterStoreKey: app.AppKeepers.GetKey(wasmtypes.StoreKey),
WasmConfig: wasmConfig,
WasmConfig: &wasmConfig,
WasmKeeper: &app.WasmKeeper,
Cdc: appCodec,

StakingKeeper: *app.AppKeepers.StakingKeeper,
Expand Down
2 changes: 1 addition & 1 deletion app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ func NewAppKeeper(
ContractDebugMode: false,
}

wasmCapabilities := "iterator,staking,stargate"
wasmCapabilities := "iterator,staking,stargate,cosmwasm_1_1"

appKeepers.WasmKeeper = wasmkeeper.NewKeeper(
appCodec,
Expand Down
12 changes: 10 additions & 2 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var mAccPerms = map[string][]string{
icatypes.ModuleName: nil,

// cosmwasm
wasmtypes.ModuleName: {},
wasmtypes.ModuleName: {authtypes.Burner},

// sge
betmoduletypes.BetFeeCollectorFunder{}.GetModuleAcc(): nil,
Expand Down Expand Up @@ -199,7 +199,15 @@ func appModules(
app.BankKeeper,
app.interfaceRegistry,
),
wasm.NewAppModule(appCodec, &app.AppKeepers.WasmKeeper, app.AppKeepers.StakingKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
wasm.NewAppModule(
appCodec,
&app.AppKeepers.WasmKeeper,
app.AppKeepers.StakingKeeper,
app.AppKeepers.AccountKeeper,
app.AppKeepers.BankKeeper,
app.MsgServiceRouter(),
app.GetSubspace(wasmtypes.ModuleName),
),
app.IBCModule,
params.NewAppModule(app.ParamsKeeper),
app.TransferModule,
Expand Down
Loading