Skip to content
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
4 changes: 4 additions & 0 deletions evm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# EVM App Changelog

## [`v0.1.1`](https://github.com/ignite/apps/releases/tag/evm/v0.1.1)

- [#235](https://github.com/ignite/apps/pull/235) Wire EVM mempool and correct start command.

## [`v0.1.0`](https://github.com/ignite/apps/releases/tag/evm/v0.1.0)

- First release of the EVM app compatible with Ignite >= v29.5.0
9 changes: 5 additions & 4 deletions evm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/gobuffalo/genny/v2 v2.1.0
github.com/gobuffalo/plush/v4 v4.1.22
github.com/hashicorp/go-plugin v1.6.3
github.com/ignite/cli/v29 v29.5.0
github.com/ignite/cli/v29 v29.6.0
github.com/stretchr/testify v1.10.0
)

Expand Down Expand Up @@ -61,7 +61,7 @@ require (
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-db v1.1.1 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect
github.com/cosmos/cosmos-sdk v0.53.3 // indirect
github.com/cosmos/cosmos-sdk v0.53.4 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/gogoproto v1.7.0 // indirect
Expand Down Expand Up @@ -199,7 +199,7 @@ require (
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e // indirect
github.com/spf13/afero v1.12.0 // indirect
github.com/spf13/cast v1.8.0 // indirect
github.com/spf13/cast v1.9.2 // indirect
github.com/spf13/cobra v1.9.1 // indirect
github.com/spf13/pflag v1.0.7 // indirect
github.com/spf13/viper v1.20.1 // indirect
Expand All @@ -216,6 +216,7 @@ require (
go.mongodb.org/mongo-driver v1.14.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
golang.org/x/arch v0.17.0 // indirect
golang.org/x/crypto v0.40.0 // indirect
golang.org/x/exp v0.0.0-20250718183923-645b1fa84792 // indirect
Expand All @@ -236,5 +237,5 @@ require (
gotest.tools/v3 v3.5.2 // indirect
nhooyr.io/websocket v1.8.6 // indirect
pgregory.net/rapid v1.2.0 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
)
21 changes: 12 additions & 9 deletions evm/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ github.com/cosmos/cosmos-db v1.1.1 h1:FezFSU37AlBC8S98NlSagL76oqBRWq/prTPvFcEJNC
github.com/cosmos/cosmos-db v1.1.1/go.mod h1:AghjcIPqdhSLP/2Z0yha5xPH3nLnskz81pBx3tcVSAw=
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
github.com/cosmos/cosmos-sdk v0.53.3 h1:GbDJNUP9OD0gGDVnjecZVZr0ZReD1BtIIxmtgrAsWiw=
github.com/cosmos/cosmos-sdk v0.53.3/go.mod h1:90S054hIbadFB1MlXVZVC5w0QbKfd1P4b79zT+vvJxw=
github.com/cosmos/cosmos-sdk v0.53.4 h1:kPF6vY68+/xi1/VebSZGpoxQqA52qkhUzqkrgeBn3Mg=
github.com/cosmos/cosmos-sdk v0.53.4/go.mod h1:7U3+WHZtI44dEOnU46+lDzBb2tFh1QlMvi8Z5JugopI=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE=
Expand Down Expand Up @@ -423,7 +423,6 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/go-github/v48 v48.2.0 h1:68puzySE6WqUY9KWmpOsDEQfDZsso98rT6pZcz9HqcE=
Expand Down Expand Up @@ -514,8 +513,8 @@ github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmK
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ignite/cli/v29 v29.5.0 h1:fEY/LTz8xjSC+UBiwCssoIB/5w2pn3UW2gIohl0OcTI=
github.com/ignite/cli/v29 v29.5.0/go.mod h1:dICC6a96N8eYxqwgar3buBduNlA4e+AVs4vH6IJltL8=
github.com/ignite/cli/v29 v29.6.0 h1:+HaYMD1unqfIo4NbHzwVCnwf9ovYCsPVlo+hS2XLolQ=
github.com/ignite/cli/v29 v29.6.0/go.mod h1:YCMxU6oBvOgb+SehwksJknNwOEj5wN7CFm7V10RU9/M=
github.com/ignite/web v1.0.8 h1:St3L6UJj70+h16+No5em8Vn2Hx93tS2G1MyWO/Kt1cc=
github.com/ignite/web v1.0.8/go.mod h1:WZWBaBYF8RazN7dE462BLpvXDY8ScacxcJ07BKwX/jY=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
Expand Down Expand Up @@ -819,8 +818,8 @@ github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e h1:qpG
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA=
github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs=
github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4=
github.com/spf13/cast v1.8.0 h1:gEN9K4b8Xws4EX0+a0reLmhq8moKn7ntRlQYgjPeCDk=
github.com/spf13/cast v1.8.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/cast v1.9.2 h1:SsGfm7M8QOFtEzumm7UZrZdLLquNdzFYfIbEXntcFbE=
github.com/spf13/cast v1.9.2/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
Expand Down Expand Up @@ -925,6 +924,10 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI=
go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
go.yaml.in/yaml/v3 v3.0.3 h1:bXOww4E/J3f66rav3pX3m8w6jDE4knZjGOw8b5Y6iNE=
go.yaml.in/yaml/v3 v3.0.3/go.mod h1:tBHosrYAkRZjRAOREWbDnBXUf08JOwYq++0QNwQiWzI=
golang.org/x/arch v0.17.0 h1:4O3dfLzd+lQewptAHqjewQZQDyEdejz3VwgeYwkZneU=
golang.org/x/arch v0.17.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
Expand Down Expand Up @@ -1215,6 +1218,6 @@ nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYm
pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk=
pgregory.net/rapid v1.2.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs=
sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
12 changes: 12 additions & 0 deletions evm/integration/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,19 @@ func TestEVM(t *testing.T) {
if !strings.Contains(buf.String(), "Querying commands for the evm module") {
t.Errorf("evmappd doesn't contain evm modules: %s", buf.String())
}
buf.Reset()

env.Must(env.Exec("check evmappd start cmd",
step.NewSteps(step.New(
step.Exec(bin, "start", "--help"),
step.Stdout(buf),
step.Workdir(app.SourcePath()),
)),
))

if !strings.Contains(buf.String(), "--evm.") {
t.Errorf("evmappd doesn't contain evm modules: %s", buf.String())
}
buf.Reset()
}

Expand Down
6 changes: 5 additions & 1 deletion evm/template/files/app/ante.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ func (app *App) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64) {
SigGasConsumer: evmante.SigVerificationGasConsumer,
MaxTxGasWanted: maxGasWanted,
TxFeeChecker: cosmosevmante.NewDynamicFeeChecker(app.FeeMarketKeeper),
PendingTxListener: func(hash common.Hash) {},
PendingTxListener: func(hash common.Hash) {
for _, listener := range app.pendingTxListeners {
listener(hash)
}
},
}
if err := options.Validate(); err != nil {
panic(err)
Expand Down
43 changes: 43 additions & 0 deletions evm/template/files/app/evm.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ import (
"cosmossdk.io/core/appmodule"
storetypes "cosmossdk.io/store/types"
"cosmossdk.io/x/tx/signing"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkmempool "github.com/cosmos/cosmos-sdk/types/mempool"
"github.com/cosmos/cosmos-sdk/types/module"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand All @@ -23,6 +26,7 @@ import (
"github.com/spf13/cast"

evmconfig "github.com/cosmos/evm/config"
evmmempool "github.com/cosmos/evm/mempool"
"github.com/cosmos/evm/precompiles/bech32"
"github.com/cosmos/evm/precompiles/p256"
srvflags "github.com/cosmos/evm/server/flags"
Expand All @@ -35,6 +39,7 @@ import (
"github.com/cosmos/evm/x/vm"
evmkeeper "github.com/cosmos/evm/x/vm/keeper"
evmtypes "github.com/cosmos/evm/x/vm/types"
"github.com/ethereum/go-ethereum/common"
gethvm "github.com/ethereum/go-ethereum/core/vm"
)

Expand Down Expand Up @@ -142,6 +147,44 @@ func (app *App) postRegisterEVMModules() error {
return nil
}

// setEVMMempool sets the EVM priority nonce mempool
// it is required for the ethereum json rpc server to work
func (app *App) setEVMMempool() {
if evmtypes.GetChainConfig() != nil {
mempoolConfig := &evmmempool.EVMMempoolConfig{
AnteHandler: app.BaseApp.AnteHandler(),
BlockGasLimit: 100_000_000,
}

evmMempool := evmmempool.NewExperimentalEVMMempool(app.CreateQueryContext, app.Logger(), app.EVMKeeper, app.FeeMarketKeeper, app.txConfig, app.clientCtx, mempoolConfig)
app.EVMMempool = evmMempool

app.SetMempool(evmMempool)
checkTxHandler := evmmempool.NewCheckTxHandler(evmMempool)
app.SetCheckTxHandler(checkTxHandler)

abciProposalHandler := baseapp.NewDefaultProposalHandler(evmMempool, app)
abciProposalHandler.SetSignerExtractionAdapter(evmmempool.NewEthSignerExtractionAdapter(sdkmempool.NewDefaultSignerExtractionAdapter()))
app.SetPrepareProposal(abciProposalHandler.PrepareProposalHandler())
}
}

// RegisterPendingTxListener a function that registers a listener for pending transactions.
func (app *App) RegisterPendingTxListener(listener func(common.Hash)) {
app.pendingTxListeners = append(app.pendingTxListeners, listener)
}

// SetClientCtx a function that sets the client context on the app, required by EVM module implementation.
func (app *App) SetClientCtx(ctx client.Context) {
app.clientCtx = ctx
}

// GetMempool returns the mempool of the app.
// It is required by the EVM application interface.
func (app *App) GetMempool() sdkmempool.ExtMempool {
return app.EVMMempool
}

// getCustomEVMActivators defines a map of opcode modifiers associated
// with a key defining the corresponding EIP.
func getCustomEVMActivators() map[int]func(*gethvm.JumpTable) {
Expand Down
18 changes: 17 additions & 1 deletion evm/template/generator_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ func appModify(appPath, binaryName string) genny.RunFn {
xast.WithNamedImport("feemarketkeeper", "github.com/cosmos/evm/x/feemarket/keeper"),
xast.WithNamedImport("ibctransferkeeper", "github.com/cosmos/evm/x/ibc/transfer/keeper"),
xast.WithNamedImport("evmkeeper", "github.com/cosmos/evm/x/vm/keeper"),
xast.WithNamedImport("evmante", "github.com/cosmos/evm/ante"),
xast.WithNamedImport("evmmempool", "github.com/cosmos/evm/mempool"),
)
if err != nil {
return err
Expand All @@ -55,6 +57,14 @@ func appModify(appPath, binaryName string) genny.RunFn {
content, err = xast.ModifyStruct(
content,
"App",
xast.AppendStructValue(
"clientCtx",
"client.Context",
),
xast.AppendStructValue(
"pendingTxListeners",
"[]evmante.PendingTxListener",
),
xast.AppendStructValue(
"FeeGrantKeeper",
"feegrantkeeper.Keeper",
Expand All @@ -71,6 +81,10 @@ func appModify(appPath, binaryName string) genny.RunFn {
"Erc20Keeper",
"erc20keeper.Keeper",
),
xast.AppendStructValue(
"EVMMempool",
"*evmmempool.ExperimentalEVMMempool",
),
)
if err != nil {
return err
Expand Down Expand Up @@ -106,7 +120,9 @@ func appModify(appPath, binaryName string) genny.RunFn {
xast.AppendFuncCodeAtLine(
`// set ante handlers
maxGasWanted := cast.ToUint64(appOpts.Get(evmsrvflags.EVMMaxTxGasWanted))
app.setAnteHandler(app.txConfig, maxGasWanted)`,
app.setAnteHandler(app.txConfig, maxGasWanted)
// set evm mempool
app.setEVMMempool()`,
12,
),
)
Expand Down
20 changes: 20 additions & 0 deletions evm/template/generator_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func commandsModify(appPath, binaryName string) genny.RunFn {
content, err := xast.AppendImports(
f.String(),
xast.WithNamedImport("cosmosevmcmd", "github.com/cosmos/evm/client"),
xast.WithNamedImport("cosmosevmserver", "github.com/cosmos/evm/server"),
)
if err != nil {
return err
Expand All @@ -33,6 +34,25 @@ func commandsModify(appPath, binaryName string) genny.RunFn {
return err
}

// replace server.AddCommandsWithStartCmdOptions with cosmosevmserver.AddCommands
content, err = xast.ModifyFunction(content, "initRootCmd",
xast.RemoveFuncCall("server.AddCommandsWithStartCmdOptions"),
xast.AppendFuncAtLine(`// add Cosmos EVM' flavored TM commands to start server, etc.
cosmosevmserver.AddCommands(
rootCmd,
cosmosevmserver.NewDefaultStartOptions(func(l log.Logger, d dbm.DB, w io.Writer, ao servertypes.AppOptions) cosmosevmserver.Application {
return newApp(l, d, w, ao).(cosmosevmserver.Application)
}, app.DefaultNodeHome),
appExport,
addModuleInitFlags,
)`,
1,
),
)
if err != nil {
return err
}

// add keyring commands
content = strings.Replace(
content,
Expand Down
Loading