Skip to content

Commit

Permalink
Merge pull request #442 from scorpioborn/fix/tx-fee-deduct
Browse files Browse the repository at this point in the history
Fix: Deduct TX fees
  • Loading branch information
scorpioborn authored Nov 5, 2024
2 parents 8c32d3f + 4ddf6c9 commit b1ced16
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
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

0 comments on commit b1ced16

Please sign in to comment.