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

feat(evm)!: updated imports to use ethermint fork #168

Merged
merged 17 commits into from
Apr 25, 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
2 changes: 1 addition & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ jobs:
path: /tmp/e2e.tar
e2e-tests:
needs: build-image
uses: dymensionxyz/e2e-tests/.github/workflows/e2e-test-workflow-call.yml@main
uses: dymensionxyz/e2e-tests/.github/workflows/e2e-test-workflow-call.yml@a3784a3388cb6c67f11266cb917eb91a70d4c665
with:
rollapp_evm_ci: "e2e"
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# [](https://github.com/dymensionxyz/rollapp-evm/compare/v2.2.0-alpha...v) (2024-04-25)


Check failure on line 3 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / markdownlint

Multiple consecutive blank lines [Expected: 1; Actual: 2]
### Bug Fixes

Check failure on line 4 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / markdownlint

Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]

* **app:** fixed bech32 on account keeper to not be hardcoded ([#165](https://github.com/dymensionxyz/rollapp-evm/issues/165)) ([750d1e7](https://github.com/dymensionxyz/rollapp-evm/commit/750d1e70ad052daf7b2942bcecaf0dddfbc17d90))
* **deps:** bumps `block-explorer-rpc-cosmos v1.0.3` & `evm-block-explorer-rpc-cosmos` v1.0.3 ([#142](https://github.com/dymensionxyz/rollapp-evm/issues/142)) ([ea5e5fd](https://github.com/dymensionxyz/rollapp-evm/commit/ea5e5fdc854d5a4fa4079c4d79b79732e78cf9d8))
Expand All @@ -13,19 +13,24 @@
* **test scripts:** make alice and bob keys in .rollap dir ([#147](https://github.com/dymensionxyz/rollapp-evm/issues/147)) ([b6ee646](https://github.com/dymensionxyz/rollapp-evm/commit/b6ee64640af1b528728414bded6a70216a4b5fdf))
* updated block size and evm `no_base_fee` ([#160](https://github.com/dymensionxyz/rollapp-evm/issues/160)) ([876ccad](https://github.com/dymensionxyz/rollapp-evm/commit/876ccad96765d0d3bd279903c552ab483ecf6b9a))


Check failure on line 16 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / markdownlint

Multiple consecutive blank lines [Expected: 1; Actual: 2]
### Features

* add swagger config and make scripts ([#130](https://github.com/dymensionxyz/rollapp-evm/issues/130)) ([41718e4](https://github.com/dymensionxyz/rollapp-evm/commit/41718e4d4098e6bf18117c31b514b2cc226a331f))
* **be:** integrate block explorer Json-RPC server ([#132](https://github.com/dymensionxyz/rollapp-evm/issues/132)) ([d73b1c4](https://github.com/dymensionxyz/rollapp-evm/commit/d73b1c451b93f04a1db5a73c4c8c78fc21729208))
* **ci:** add addtional changelog log auto update workflow ([327f375](https://github.com/dymensionxyz/rollapp-evm/commit/327f375cdb7e33c431a8d5f0a710a52b641e7eca))
* **ci:** Add changelog log auto update workflow ([#176](https://github.com/dymensionxyz/rollapp-evm/issues/176)) ([f58feaa](https://github.com/dymensionxyz/rollapp-evm/commit/f58feaaea83b17d2258d1025a72c9b832922b7a9))


Check failure on line 23 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / markdownlint

Multiple consecutive blank lines [Expected: 1; Actual: 2]
### Reverts

* Revert "removed explorer" ([b72fbb7](https://github.com/dymensionxyz/rollapp-evm/commit/b72fbb767580436293151bf73174f77d891f3099))


Check failure on line 28 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / markdownlint

Multiple consecutive blank lines [Expected: 1; Actual: 2]

Check failure on line 29 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / markdownlint

Multiple consecutive blank lines [Expected: 1; Actual: 3]
# [2.2.0-alpha](https://github.com/dymensionxyz/rollapp-evm/compare/v2.1.0-alpha...v2.2.0-alpha) (2024-03-26)

Check failure on line 30 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / markdownlint

Multiple top-level headings in the same document [Context: "# [2.2.0-alpha](https://github..."]


Check failure on line 32 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / markdownlint

Multiple consecutive blank lines [Expected: 1; Actual: 2]
### Bug Fixes

Check failure on line 33 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / markdownlint

Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]

Check failure on line 33 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / markdownlint

Multiple headings with the same content [Context: "### Bug Fixes"]

* updated init.sh to set gensis operator address ([#123](https://github.com/dymensionxyz/rollapp-evm/issues/123)) ([7cb34f8](https://github.com/dymensionxyz/rollapp-evm/commit/7cb34f84740a244fb168a2c2864303cbdcffe827))

Expand Down
109 changes: 45 additions & 64 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
tmos "github.com/tendermint/tendermint/libs/os"
dbm "github.com/tendermint/tm-db"

"github.com/evmos/ethermint/x/evm/vm/geth"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
Expand Down Expand Up @@ -98,8 +100,6 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"
ibctestingtypes "github.com/cosmos/ibc-go/v6/testing/types"

srvflags "github.com/evmos/evmos/v12/server/flags"

rollappparams "github.com/dymensionxyz/rollapp-evm/app/params"

// unnamed import of statik for swagger UI support
Expand All @@ -118,25 +118,26 @@ import (
"github.com/dymensionxyz/dymension-rdk/x/denommetadata"
denommetadatamodulekeeper "github.com/dymensionxyz/dymension-rdk/x/denommetadata/keeper"
denommetadatamoduletypes "github.com/dymensionxyz/dymension-rdk/x/denommetadata/types"
ethante "github.com/evmos/evmos/v12/app/ante"
ethanteevm "github.com/evmos/evmos/v12/app/ante/evm"
"github.com/evmos/evmos/v12/ethereum/eip712"
ethermint "github.com/evmos/evmos/v12/types"
"github.com/evmos/evmos/v12/x/claims"
claimskeeper "github.com/evmos/evmos/v12/x/claims/keeper"
claimstypes "github.com/evmos/evmos/v12/x/claims/types"
"github.com/evmos/evmos/v12/x/erc20"
erc20client "github.com/evmos/evmos/v12/x/erc20/client"
erc20keeper "github.com/evmos/evmos/v12/x/erc20/keeper"
erc20types "github.com/evmos/evmos/v12/x/erc20/types"
"github.com/evmos/evmos/v12/x/evm"
evmkeeper "github.com/evmos/evmos/v12/x/evm/keeper"
evmtypes "github.com/evmos/evmos/v12/x/evm/types"
"github.com/evmos/evmos/v12/x/feemarket"
feemarketkeeper "github.com/evmos/evmos/v12/x/feemarket/keeper"
feemarkettypes "github.com/evmos/evmos/v12/x/feemarket/types"
"github.com/evmos/evmos/v12/x/ibc/transfer"
transferkeeper "github.com/evmos/evmos/v12/x/ibc/transfer/keeper"

/* ------------------------------ ethermint imports ----------------------------- */

ethante "github.com/evmos/ethermint/app/ante"
"github.com/evmos/ethermint/ethereum/eip712"
srvflags "github.com/evmos/ethermint/server/flags"
ethermint "github.com/evmos/ethermint/types"
"github.com/evmos/ethermint/x/erc20"
erc20client "github.com/evmos/ethermint/x/erc20/client"
erc20keeper "github.com/evmos/ethermint/x/erc20/keeper"
erc20types "github.com/evmos/ethermint/x/erc20/types"
"github.com/evmos/ethermint/x/evm"
evmkeeper "github.com/evmos/ethermint/x/evm/keeper"
evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/evmos/ethermint/x/feemarket"
feemarketkeeper "github.com/evmos/ethermint/x/feemarket/keeper"
feemarkettypes "github.com/evmos/ethermint/x/feemarket/types"

"github.com/evmos/ethermint/x/erc20/transfer"
transferkeeper "github.com/evmos/ethermint/x/erc20/transfer/keeper"

// Force-load the tracer engines to trigger registration due to Go-Ethereum v1.10.15 changes
_ "github.com/ethereum/go-ethereum/eth/tracers/js"
Expand All @@ -161,7 +162,6 @@ var (
evmtypes.StoreKey, feemarkettypes.StoreKey,
// evmos keys
erc20types.StoreKey,
claimstypes.StoreKey,
denommetadatamoduletypes.StoreKey,
}
)
Expand Down Expand Up @@ -216,7 +216,6 @@ var (
// Evmos moudles
erc20.AppModuleBasic{},
transfer.AppModuleBasic{AppModuleBasic: &ibctransfer.AppModuleBasic{}},
claims.AppModuleBasic{},
denommetadata.AppModuleBasic{},
)

Expand All @@ -232,12 +231,11 @@ var (
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account
erc20types.ModuleName: {authtypes.Minter, authtypes.Burner},
claimstypes.ModuleName: nil,
hubgentypes.ModuleName: {authtypes.Burner},
denommetadatamoduletypes.ModuleName: nil,
}

// module accounts that are allowed to receive tokens
// module accounts that are allowed to receive tokens directly from users
allowedReceivingModAcc = map[string]bool{
distrtypes.ModuleName: true,
}
Expand All @@ -258,9 +256,6 @@ func init() {

// manually update the power reduction by replacing micro (u) -> atto (a) evmos
sdk.DefaultPowerReduction = ethermint.PowerReduction

// disable claims on genesis
claimstypes.DefaultEnableClaims = false
}

// App extends an ABCI application, but with most of its parameters exported.
Expand Down Expand Up @@ -307,8 +302,7 @@ type App struct {
FeeMarketKeeper feemarketkeeper.Keeper

// Evmos keepers
Erc20Keeper erc20keeper.Keeper
ClaimsKeeper *claimskeeper.Keeper
Erc20Keeper erc20keeper.Keeper

DenomMetadataKeeper denommetadatamodulekeeper.Keeper

Expand Down Expand Up @@ -483,7 +477,12 @@ func NewRollapp(
app.EvmKeeper = evmkeeper.NewKeeper(
appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], authtypes.NewModuleAddress(govtypes.ModuleName),
app.AccountKeeper, app.BankKeeper, app.SequencersKeeper, app.FeeMarketKeeper,
tracer, app.GetSubspace(evmtypes.ModuleName),
nil, geth.NewEVM, tracer, app.GetSubspace(evmtypes.ModuleName),
)

app.Erc20Keeper = erc20keeper.NewKeeper(
keys[erc20types.StoreKey], appCodec, authtypes.NewModuleAddress(govtypes.ModuleName),
app.AccountKeeper, app.BankKeeper, app.EvmKeeper, app.StakingKeeper,
)

// Create IBC Keeper
Expand Down Expand Up @@ -514,17 +513,6 @@ func NewRollapp(
&stakingKeeper, govRouter, app.MsgServiceRouter(), govConfig,
)

// Create evmos keeper
app.ClaimsKeeper = claimskeeper.NewKeeper(
appCodec, keys[claimstypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName),
app.AccountKeeper, app.BankKeeper, &stakingKeeper, app.DistrKeeper, app.IBCKeeper.ChannelKeeper,
)

app.Erc20Keeper = erc20keeper.NewKeeper(
keys[erc20types.StoreKey], appCodec, authtypes.NewModuleAddress(govtypes.ModuleName),
app.AccountKeeper, app.BankKeeper, app.EvmKeeper, app.StakingKeeper,
)

app.GovKeeper = *govKeeper.SetHooks(
govtypes.NewMultiGovHooks(
// register the governance hooks
Expand Down Expand Up @@ -552,7 +540,7 @@ func NewRollapp(

app.TransferKeeper = transferkeeper.NewKeeper(
appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName),
app.ClaimsKeeper, // ICS4 Wrapper: claims IBC middleware
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper,
app.AccountKeeper, app.BankKeeper, scopedTransferKeeper,
app.Erc20Keeper, // Add ERC20 Keeper for ERC20 transfers
Expand All @@ -567,18 +555,13 @@ func NewRollapp(
app.AccountKeeper,
)

// NOTE: app.Erc20Keeper is already initialized elsewhere
// Set the ICS4 wrappers for custom module middlewares
app.ClaimsKeeper.SetICS4Wrapper(app.IBCKeeper.ChannelKeeper)

// Override the ICS20 app module
transferModule := transfer.NewAppModule(app.TransferKeeper)

// create IBC module from top to bottom of stack
var transferStack ibcporttypes.IBCModule

transferStack = transfer.NewIBCModule(app.TransferKeeper)
transferStack = claims.NewIBCMiddleware(*app.ClaimsKeeper, transferStack)
transferStack = erc20.NewIBCMiddleware(app.Erc20Keeper, transferStack)

// Create static IBC router, add transfer route, then set and seal it
Expand Down Expand Up @@ -614,12 +597,11 @@ func NewRollapp(
hubgenesis.NewAppModule(appCodec, app.HubGenesisKeeper, app.AccountKeeper),

// Ethermint app modules
evm.NewAppModule(app.EvmKeeper, app.AccountKeeper, app.GetSubspace(evmtypes.ModuleName)),
evm.NewAppModule(app.EvmKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(evmtypes.ModuleName)),
feemarket.NewAppModule(app.FeeMarketKeeper, app.GetSubspace(feemarkettypes.ModuleName)),
// Evmos app modules
transferModule,
erc20.NewAppModule(app.Erc20Keeper, app.AccountKeeper, app.GetSubspace(erc20types.ModuleName)),
claims.NewAppModule(appCodec, *app.ClaimsKeeper, app.GetSubspace(claimstypes.ModuleName)),
denommetadata.NewAppModule(app.DenomMetadataKeeper, app.BankKeeper),
}

Expand Down Expand Up @@ -647,7 +629,6 @@ func NewRollapp(
banktypes.ModuleName,
govtypes.ModuleName,
erc20types.ModuleName,
claimstypes.ModuleName,
genutiltypes.ModuleName,
feegrant.ModuleName,
epochstypes.ModuleName,
Expand All @@ -671,7 +652,6 @@ func NewRollapp(
vestingtypes.ModuleName,
minttypes.ModuleName,
erc20types.ModuleName,
claimstypes.ModuleName,
genutiltypes.ModuleName,
feegrant.ModuleName,
epochstypes.ModuleName,
Expand Down Expand Up @@ -707,7 +687,6 @@ func NewRollapp(
ibchost.ModuleName,
genutiltypes.ModuleName,
erc20types.ModuleName,
claimstypes.ModuleName,

paramstypes.ModuleName,
upgradetypes.ModuleName,
Expand Down Expand Up @@ -768,27 +747,30 @@ func NewRollapp(

func (app *App) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64) {
options := ethante.HandlerOptions{
Cdc: app.appCodec,
AccountKeeper: app.AccountKeeper,
BankKeeper: app.BankKeeper,
ExtensionOptionChecker: ethermint.HasDynamicFeeExtensionOption,
SignModeHandler: txConfig.SignModeHandler(),
EvmKeeper: app.EvmKeeper,
StakingKeeper: app.StakingKeeper,
FeegrantKeeper: app.FeeGrantKeeper,
DistributionKeeper: app.DistrKeeper,
IBCKeeper: app.IBCKeeper,
FeeMarketKeeper: app.FeeMarketKeeper,
SignModeHandler: txConfig.SignModeHandler(),
SigGasConsumer: ethante.SigVerificationGasConsumer,
SigGasConsumer: ethante.DefaultSigVerificationGasConsumer,
MaxTxGasWanted: maxGasWanted,
TxFeeChecker: ethanteevm.NewDynamicFeeChecker(app.EvmKeeper),
ExtensionOptionChecker: ethermint.HasDynamicFeeExtensionOption,
TxFeeChecker: ethante.NewDynamicFeeChecker(app.EvmKeeper),
DisabledAuthzMsgs: []string{
sdk.MsgTypeURL(&evmtypes.MsgEthereumTx{}),
sdk.MsgTypeURL(&vestingtypes.MsgCreateVestingAccount{}),
sdk.MsgTypeURL(&vestingtypes.MsgCreatePeriodicVestingAccount{}),
sdk.MsgTypeURL(&vestingtypes.MsgCreatePermanentLockedAccount{}),
},
}

if err := options.Validate(); err != nil {
handler, err := ethante.NewAnteHandler(options)
if err != nil {
panic(err)
}

app.SetAnteHandler(ethante.NewAnteHandler(options))
app.SetAnteHandler(handler)
}

func (app *App) setPostHandler() {
Expand Down Expand Up @@ -1053,7 +1035,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(feemarkettypes.ModuleName)
// evmos subspaces
paramsKeeper.Subspace(erc20types.ModuleName)
paramsKeeper.Subspace(claimstypes.ModuleName)
paramsKeeper.Subspace(denommetadatamoduletypes.ModuleName)

return paramsKeeper
Expand Down
4 changes: 2 additions & 2 deletions app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/cosmos/cosmos-sdk/std"
sdk "github.com/cosmos/cosmos-sdk/types"

cryptocodec "github.com/evmos/evmos/v12/crypto/codec"
ethermint "github.com/evmos/evmos/v12/types"
cryptocodec "github.com/evmos/ethermint/crypto/codec"
ethermint "github.com/evmos/ethermint/types"

"github.com/dymensionxyz/rollapp-evm/app/params"
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/rollappd/cmd/genaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"

ethtutil "github.com/ethereum/go-ethereum/common"
"github.com/evmos/evmos/v12/crypto/hd"
ethermint "github.com/evmos/evmos/v12/types"
evmtypes "github.com/evmos/evmos/v12/x/evm/types"
"github.com/evmos/ethermint/crypto/hd"
ethermint "github.com/evmos/ethermint/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
)

const (
Expand Down
8 changes: 4 additions & 4 deletions cmd/rollappd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/flags"
pruningtypes "github.com/cosmos/cosmos-sdk/pruning/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/evmos/evmos/v12/crypto/hd"
"github.com/evmos/ethermint/crypto/hd"

berpcconfig "github.com/bcdevtools/block-explorer-rpc-cosmos/be_rpc/config"
"github.com/cosmos/cosmos-sdk/client/rpc"
Expand All @@ -39,11 +39,11 @@ import (
"github.com/dymensionxyz/rollapp-evm/app/params"
"github.com/dymensionxyz/rollapp-evm/utils"

ethermintclient "github.com/evmos/evmos/v12/client"
ethermintclient "github.com/evmos/ethermint/client"

rdk_genutilcli "github.com/dymensionxyz/dymension-rdk/x/genutil/client/cli"
evmserver "github.com/evmos/evmos/v12/server"
evmconfig "github.com/evmos/evmos/v12/server/config"
evmserver "github.com/evmos/ethermint/server"
evmconfig "github.com/evmos/ethermint/server/config"
)

const rollappAscii = `
Expand Down
12 changes: 6 additions & 6 deletions cmd/rollappd/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ import (
dymintnode "github.com/dymensionxyz/dymint/node"
dymintrpc "github.com/dymensionxyz/dymint/rpc"

"github.com/evmos/evmos/v12/indexer"
ethserver "github.com/evmos/evmos/v12/server"
"github.com/evmos/evmos/v12/server/config"
ethconfig "github.com/evmos/evmos/v12/server/config"
srvflags "github.com/evmos/evmos/v12/server/flags"
ethermint "github.com/evmos/evmos/v12/types"
"github.com/evmos/ethermint/indexer"
ethserver "github.com/evmos/ethermint/server"
"github.com/evmos/ethermint/server/config"
ethconfig "github.com/evmos/ethermint/server/config"
srvflags "github.com/evmos/ethermint/server/flags"
ethermint "github.com/evmos/ethermint/types"
)

const (
Expand Down
Loading
Loading