Skip to content

Commit

Permalink
refactor: remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
Unique-Divine committed Jun 7, 2024
1 parent cad00c0 commit e4e11df
Showing 1 changed file with 14 additions and 47 deletions.
61 changes: 14 additions & 47 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func NewAnteHandler(

var anteHandler sdk.AnteHandler
hasExt, typeUrl := TxHasExtensions(tx)
// TODO: handle ethereum txs
if hasExt && typeUrl != "" {
anteHandler = AnteHandlerExtendedTx(typeUrl, keepers, opts, ctx)
return anteHandler(ctx, tx, sim)
Expand All @@ -47,52 +46,6 @@ func NewAnteHandler(
}
}

// TODO: UD: REMOVE ME
// func AnteHandlerStandardTx(opts ante.AnteHandlerOptions) sdk.AnteHandler {
// anteDecorators := []sdk.AnteDecorator{
// AnteDecoratorPreventEtheruemTxMsgs{}, // reject MsgEthereumTxs
// authante.NewSetUpContextDecorator(),
// wasmkeeper.NewLimitSimulationGasDecorator(opts.WasmConfig.SimulationGasLimit),
// wasmkeeper.NewCountTXDecorator(opts.TxCounterStoreKey),
// authante.NewExtensionOptionsDecorator(opts.ExtensionOptionChecker),
// authante.NewValidateBasicDecorator(),
// authante.NewTxTimeoutHeightDecorator(),
// authante.NewValidateMemoDecorator(opts.AccountKeeper),
// ante.AnteDecoratorEnsureSinglePostPriceMessage{},
// ante.AnteDecoratorStakingCommission{},
// authante.NewConsumeGasForTxSizeDecorator(opts.AccountKeeper),
// // Replace fee ante from cosmos auth with a custom one.
// authante.NewDeductFeeDecorator(
// opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper, opts.TxFeeChecker),
// // devgas
// devgasante.NewDevGasPayoutDecorator(
// opts.DevGasBankKeeper, opts.DevGasKeeper),
// // NOTE: SetPubKeyDecorator must be called before all signature verification decorators
// authante.NewSetPubKeyDecorator(opts.AccountKeeper),
// authante.NewValidateSigCountDecorator(opts.AccountKeeper),
// authante.NewSigGasConsumeDecorator(opts.AccountKeeper, opts.SigGasConsumer),
// authante.NewSigVerificationDecorator(opts.AccountKeeper, opts.SignModeHandler),
// authante.NewIncrementSequenceDecorator(opts.AccountKeeper),
// ibcante.NewRedundantRelayDecorator(opts.IBCKeeper),
// }

// return sdk.ChainAnteDecorators(anteDecorators...)
// }

func TxHasExtensions(tx sdk.Tx) (hasExt bool, typeUrl string) {
extensionTx, ok := tx.(authante.HasExtensionOptionsTx)
if !ok {
return false, ""
}

extOpts := extensionTx.GetExtensionOptions()
if len(extOpts) == 0 {
return false, ""
}

return true, extOpts[0].GetTypeUrl()
}

func AnteHandlerExtendedTx(
typeUrl string,
keepers AppKeepers,
Expand Down Expand Up @@ -152,3 +105,17 @@ func NewAnteHandlerNonEVM(
AnteDecoratorGasWanted{},
)
}

func TxHasExtensions(tx sdk.Tx) (hasExt bool, typeUrl string) {
extensionTx, ok := tx.(authante.HasExtensionOptionsTx)
if !ok {
return false, ""
}

extOpts := extensionTx.GetExtensionOptions()
if len(extOpts) == 0 {
return false, ""
}

return true, extOpts[0].GetTypeUrl()
}

0 comments on commit e4e11df

Please sign in to comment.