Skip to content

Commit

Permalink
fix(ante): FeeMarket minGasPrice enforcement (#1602)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsitrin authored Dec 3, 2024
1 parent ed7dde7 commit b98c7cf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
9 changes: 8 additions & 1 deletion app/ante/ante_options.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ante

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
Expand All @@ -16,11 +17,17 @@ import (
txfeeskeeper "github.com/osmosis-labs/osmosis/v15/x/txfees/keeper"
)

// FeeMarketKeeper defines the expected keeper interface used on the AnteHandler
type FeeMarketKeeper interface {
ethante.FeeMarketKeeper
GetMinGasPrice(ctx sdk.Context) (minGasPrice sdk.Dec)
}

type HandlerOptions struct {
AccountKeeper *authkeeper.AccountKeeper
BankKeeper bankkeeper.Keeper
IBCKeeper *ibckeeper.Keeper
FeeMarketKeeper ethante.FeeMarketKeeper
FeeMarketKeeper FeeMarketKeeper
EvmKeeper ethante.EVMKeeper
FeegrantKeeper ante.FeegrantKeeper
TxFeesKeeper *txfeeskeeper.Keeper
Expand Down
4 changes: 2 additions & 2 deletions app/ante/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler {
// newLegacyCosmosAnteHandlerEip712 creates an AnteHandler to process legacy EIP-712
// transactions, as defined by the presence of an ExtensionOptionsWeb3Tx extension.
func newLegacyCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler {
mempoolFeeDecorator := txfeesante.NewMempoolFeeDecorator(*options.TxFeesKeeper)
mempoolFeeDecorator := txfeesante.NewMempoolFeeDecorator(*options.TxFeesKeeper, options.FeeMarketKeeper)
deductFeeDecorator := txfeesante.NewDeductFeeDecorator(*options.TxFeesKeeper, options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper)

return sdk.ChainAnteDecorators(
Expand Down Expand Up @@ -86,7 +86,7 @@ func newLegacyCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler {
}

func newCosmosAnteHandler(options HandlerOptions) sdk.AnteHandler {
mempoolFeeDecorator := txfeesante.NewMempoolFeeDecorator(*options.TxFeesKeeper)
mempoolFeeDecorator := txfeesante.NewMempoolFeeDecorator(*options.TxFeesKeeper, options.FeeMarketKeeper)
deductFeeDecorator := txfeesante.NewDeductFeeDecorator(*options.TxFeesKeeper, options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper)

return sdk.ChainAnteDecorators(
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ replace (
cosmossdk.io/api => cosmossdk.io/api v0.3.1

// use dymension forks
github.com/evmos/ethermint => github.com/dymensionxyz/ethermint v0.22.0-dymension-v1.0.0
github.com/evmos/ethermint => github.com/dymensionxyz/ethermint v0.22.0-dymension-v1.0.0.0.20241202124813-c7838a77b8f6
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/osmosis-labs/osmosis/osmomath => github.com/dymensionxyz/osmosis/osmomath v0.0.6-dymension-v0.1.0.20240820121212-c0e21fa21e43
github.com/osmosis-labs/osmosis/v15 => github.com/dymensionxyz/osmosis/v15 v15.2.1-0.20241121091134-5930c0d433a8
github.com/osmosis-labs/osmosis/v15 => github.com/dymensionxyz/osmosis/v15 v15.2.1-0.20241202152541-b4fc63e3fe20

// broken goleveldb
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -500,14 +500,14 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY=
github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU=
github.com/dymensionxyz/ethermint v0.22.0-dymension-v1.0.0 h1:pND0fMCE5xv2A5eyXdSCI8+a+XaxvCNvC0+4Ac7TsTg=
github.com/dymensionxyz/ethermint v0.22.0-dymension-v1.0.0/go.mod h1:aokD0im7cUMMtR/khzNsmcGtINtxCpBfcgRvJdmLymA=
github.com/dymensionxyz/ethermint v0.22.0-dymension-v1.0.0.0.20241202124813-c7838a77b8f6 h1:YHircCv0aQSIz0T8N/C8upYHfAlsY8y80hAsxqkWtfA=
github.com/dymensionxyz/ethermint v0.22.0-dymension-v1.0.0.0.20241202124813-c7838a77b8f6/go.mod h1:aokD0im7cUMMtR/khzNsmcGtINtxCpBfcgRvJdmLymA=
github.com/dymensionxyz/gerr-cosmos v1.1.0 h1:IW/P7HCB/iP9kgk3VXaWUoMoyx3vD76YO6p1fnubHVc=
github.com/dymensionxyz/gerr-cosmos v1.1.0/go.mod h1:n+0olxPogzWqFKba45mCpvrHLGmeS8W9UZjggHnWk6c=
github.com/dymensionxyz/osmosis/osmomath v0.0.6-dymension-v0.1.0.20240820121212-c0e21fa21e43 h1:EskhZ6ILN3vwJ6l8gPWPZ49RFSB52WghT5v+pmzrNCI=
github.com/dymensionxyz/osmosis/osmomath v0.0.6-dymension-v0.1.0.20240820121212-c0e21fa21e43/go.mod h1:SdGCL9CZb14twRAJUSzb7bRE0OoopRpF2Hnd1UhJpFU=
github.com/dymensionxyz/osmosis/v15 v15.2.1-0.20241121091134-5930c0d433a8 h1:AwKgKV4uBZcylJarkT+W8K5FFjH/0tu3q4pzGRJsv+A=
github.com/dymensionxyz/osmosis/v15 v15.2.1-0.20241121091134-5930c0d433a8/go.mod h1:sXttKj99Ke160CvjID+5hvOG3TEF/K1k/Eqa37EhRCc=
github.com/dymensionxyz/osmosis/v15 v15.2.1-0.20241202152541-b4fc63e3fe20 h1:HQitz73Icw+YHPg56m284yYQVwf1XhKqfbbduX5SGes=
github.com/dymensionxyz/osmosis/v15 v15.2.1-0.20241202152541-b4fc63e3fe20/go.mod h1:sXttKj99Ke160CvjID+5hvOG3TEF/K1k/Eqa37EhRCc=
github.com/dymensionxyz/sdk-utils v0.2.12 h1:wrcof+IP0AJQ7vvMRVpSekNNwa6B7ghAspHRjp/k+Lk=
github.com/dymensionxyz/sdk-utils v0.2.12/go.mod h1:it9owYOpnIe17+ftTATQNDN4z+mBQx20/2Jm8SK15Rk=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
Expand Down

0 comments on commit b98c7cf

Please sign in to comment.