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

Feature/evm module #447

Merged
merged 32 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
68fd148
resolve dependencies
mn13 Jun 24, 2024
8489c1d
update changelog
mn13 Jun 25, 2024
548aa3c
register evm & feemarket keepers WIP
mn13 Jun 25, 2024
33a45f3
missed register
mn13 Jun 25, 2024
eff883b
missed configs
mn13 Jun 26, 2024
53d52de
make different getters for evmOS getters as possible fix
mn13 Jun 26, 2024
c3b1a33
correct getting of transient store
mn13 Jul 1, 2024
c11591c
evm ante
mn13 Jul 2, 2024
77e78c0
missing ante decorators: reject eth tx for cosmos tx & eip-1559 gas calc
mn13 Jul 3, 2024
c82d460
rm doubling SetCmdClientContextHandler
mn13 Jul 3, 2024
d9ed3ec
evm JSON-RPC server WIP
mn13 Jul 4, 2024
2943420
adopting ethsecp256k1 signging
mn13 Jul 8, 2024
06ef127
update changelog
mn13 Jul 8, 2024
71f8ad4
use award instead of uward
mn13 Jul 10, 2024
078104b
add setting evmOS params on migration
mn13 Jul 10, 2024
c3bb7da
extend customAppConfig with emv configs
mn13 Jul 11, 2024
f40b508
rm unused ProvideInterfaceRegistryNoValidation
mn13 Jul 17, 2024
cd71f6f
use evmOS's cosmos-sdk
mn13 Aug 2, 2024
238483a
fix eth sign types issues
mn13 Aug 13, 2024
e4c7b16
rm print
mn13 Aug 14, 2024
91d9b2d
bump cosmos-sdk version
mn13 Aug 14, 2024
e1ebdbc
edit changelog
mn13 Aug 14, 2024
0a4b030
regenerate tests snapshots
mn13 Aug 15, 2024
f726b23
update changelog
mn13 Aug 15, 2024
a27a186
bump sdk to v0.50.9
mn13 Aug 28, 2024
0a0d485
rebase fixes
mn13 Aug 28, 2024
6537943
go mod tidy
mn13 Aug 29, 2024
379903b
rm evm part from upgrade
mn13 Aug 30, 2024
b4ac60b
review updates
mn13 Sep 2, 2024
e4de871
go mod tidy
mn13 Sep 2, 2024
6671868
fix denom in tests
mn13 Sep 2, 2024
388e3ac
Merge branch 'main' into feature/evm-module
mn13 Sep 4, 2024
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* (x/act) Add support for sdk.Coins fields in autogenerated CLI commands for new actions
* (x/warden) Add the ability for the user to specify the maximum keychain fee size to be deducted
* (x/warden) Return error if analyzer's address is not bench32
* (evm) Resolve dependencies issues. For go-ethereum use [evmos fork](https://github.com/evmos/go-ethereum/releases/tag/v1.10.26-evmos-rc2) patched with [c1b68f1d05a7ee8eee1bde3c4054f49f5d3e3b9f](https://github.com/ethereum/go-ethereum/pull/24911) from original repository to support slinky.
* (evm) To adopt ethsecp256k1 use fork of evmos's cosmos-sdk. Fork patched runtime/module adding into ProvideApp two arguments to customize registering interface registry and legacy amino codec.
* (evm) Introduce award denomination to adjust units with Ethereum
* (evm) Using ethsecp256k1 signature for all transactions. Users should reimport their seeds to get new addresses.

### Bug Fixes
* (x/gmp) Remove the GMP default params from genesis
Expand Down
8 changes: 4 additions & 4 deletions cmd/faucet-v2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import (

type Config struct {
CliName string `env:"CLI_NAME, default=wardend"`
ChainID string `env:"CHAIN_ID, default=warden"`
ChainID string `env:"CHAIN_ID, default=warden_1337-1"`
KeyringBackend string `env:"KEYRING_BACKEND, default=test"`
Node string `env:"NODE, default=http://localhost:26657"`
SendDenom string `env:"DENOM, default=10000000uward"`
SendDenom string `env:"DENOM, default=10000000000000000000award"`
AccountName string `env:"ACCOUNT_NAME, default=shulgin"`
Mnemonic string `env:"MNEMONIC"`
HDPath string `env:"HD_PATH, default=m/44'/118'/0'/0/0"`
Fees string `env:"FEES, default=1uward"`
HDPath string `env:"HD_PATH, default=m/44'/60'/0'/0/0"`
Fees string `env:"FEES, default=1award"`
OtherFlags string `env:"OTHER_FLAGS"`

Cooldown time.Duration `env:"COOLDOWN, default=12h"`
Expand Down
43 changes: 38 additions & 5 deletions cmd/wardend/cmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
confixcmd "cosmossdk.io/tools/confix/cmd"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/debug"

// "github.com/cosmos/cosmos-sdk/client/debug"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/client/pruning"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/client/snapshot"
Expand All @@ -25,10 +25,16 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
"github.com/cosmos/cosmos-sdk/x/crisis"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
"github.com/spf13/cobra"
"github.com/spf13/viper"

banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
evmosclient "github.com/evmos/evmos/v18/client"
"github.com/evmos/evmos/v18/client/debug"
evmosserver "github.com/evmos/evmos/v18/server"
"github.com/warden-protocol/wardenprotocol/warden/app"
)

Expand All @@ -47,7 +53,12 @@ func initRootCmd(
snapshot.Cmd(newApp),
)

server.AddCommands(rootCmd, app.DefaultNodeHome, newApp, appExport, addModuleInitFlags)
evmosserver.AddCommands(
rootCmd,
evmosserver.NewDefaultStartOptions(newApp, app.DefaultNodeHome),
appExport,
addModuleInitFlags,
)

// add keybase, auxiliary RPC, query, genesis, and tx child commands
rootCmd.AddCommand(
Expand All @@ -58,20 +69,42 @@ func initRootCmd(
AddGenesisSpaceCmd(app.DefaultNodeHome),
AddGenesisKeychainCmd(app.DefaultNodeHome),
AddGenesisSlinkyMarketsCmd(app.DefaultNodeHome),
AddGenesisAccountCmd(app.DefaultNodeHome),
),
queryCommand(),
txCommand(),
keys.Commands(),
evmosclient.KeyCommands(app.DefaultNodeHome),
)
}

func addModuleInitFlags(startCmd *cobra.Command) {
crisis.AddModuleInitFlags(startCmd)
}

// Analog of sdk's CommandsWithCustomMigrationMap without AddGenesisAccountCmd, that should be embeded separately
func CommandsWithCustomMigrationMap(txConfig client.TxConfig, moduleBasics module.BasicManager, defaultNodeHome string, migrationMap genutiltypes.MigrationMap) *cobra.Command {
cmd := &cobra.Command{
Use: "genesis",
Short: "Application's genesis-related subcommands",
DisableFlagParsing: false,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
gentxModule := moduleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic)

cmd.AddCommand(
genutilcli.GenTxCmd(moduleBasics, txConfig, banktypes.GenesisBalancesIterator{}, defaultNodeHome, txConfig.SigningContext().ValidatorAddressCodec()),
genutilcli.MigrateGenesisCmd(migrationMap),
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, defaultNodeHome, gentxModule.GenTxValidator, txConfig.SigningContext().ValidatorAddressCodec()),
genutilcli.ValidateGenesisCmd(moduleBasics),
)

return cmd
}

// genesisCommand builds genesis-related `wardend genesis` command. Users may provide application specific commands as a parameter
func genesisCommand(txConfig client.TxConfig, basicManager module.BasicManager, cmds ...*cobra.Command) *cobra.Command {
cmd := genutilcli.Commands(txConfig, basicManager, app.DefaultNodeHome)
cmd := CommandsWithCustomMigrationMap(txConfig, basicManager, app.DefaultNodeHome, genutilcli.MigrationMap)

for _, subCmd := range cmds {
cmd.AddCommand(subCmd)
Expand Down
41 changes: 37 additions & 4 deletions cmd/wardend/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
cmtcfg "github.com/cometbft/cometbft/config"
serverconfig "github.com/cosmos/cosmos-sdk/server/config"

evmservercfg "github.com/evmos/evmos/v18/server/config"
oracleconfig "github.com/skip-mev/slinky/oracle/config"
)

Expand All @@ -28,7 +29,11 @@ func initAppConfig() (string, interface{}) {
type CustomAppConfig struct {
serverconfig.Config `mapstructure:",squash"`

Oracle oracleconfig.AppConfig `mapstructure:"oracle"`
Oracle oracleconfig.AppConfig `mapstructure:"oracle"`
EVM evmservercfg.EVMConfig `mapstructure:"evm"`
JSONRPC evmservercfg.JSONRPCConfig `mapstructure:"json-rpc"`
TLS evmservercfg.TLSConfig `mapstructure:"tls"`
Rosetta evmservercfg.RosettaConfig `mapstructure:"rosetta"`
}

// Optionally allow the chain developer to overwrite the SDK's default
Expand Down Expand Up @@ -56,12 +61,40 @@ func initAppConfig() (string, interface{}) {
MetricsEnabled: false,
}

evmConfig := evmservercfg.DefaultEVMConfig()
jsonRpcConfig := evmservercfg.JSONRPCConfig{
Enable: true,
API: evmservercfg.GetDefaultAPINamespaces(),
Address: evmservercfg.DefaultJSONRPCAddress,
WsAddress: evmservercfg.DefaultJSONRPCWsAddress,
GasCap: evmservercfg.DefaultGasCap,
AllowInsecureUnlock: evmservercfg.DefaultJSONRPCAllowInsecureUnlock,
EVMTimeout: evmservercfg.DefaultEVMTimeout,
TxFeeCap: evmservercfg.DefaultTxFeeCap,
FilterCap: evmservercfg.DefaultFilterCap,
FeeHistoryCap: evmservercfg.DefaultFeeHistoryCap,
BlockRangeCap: evmservercfg.DefaultBlockRangeCap,
LogsCap: evmservercfg.DefaultLogsCap,
HTTPTimeout: evmservercfg.DefaultHTTPTimeout,
HTTPIdleTimeout: evmservercfg.DefaultHTTPIdleTimeout,
AllowUnprotectedTxs: evmservercfg.DefaultAllowUnprotectedTxs,
MaxOpenConnections: evmservercfg.DefaultMaxOpenConnections,
EnableIndexer: false,
MetricsAddress: evmservercfg.DefaultJSONRPCMetricsAddress,
FixRevertGasRefundHeight: evmservercfg.DefaultFixRevertGasRefundHeight,
}
tlsConfig := evmservercfg.DefaultTLSConfig()

customAppConfig := CustomAppConfig{
Config: *srvCfg,
Oracle: oracleConfig,
Config: *srvCfg,
Oracle: oracleConfig,
EVM: *evmConfig,
JSONRPC: jsonRpcConfig,
TLS: *tlsConfig,
Rosetta: *evmservercfg.DefaultRosettaConfig(),
}

customAppTemplate := serverconfig.DefaultConfigTemplate + oracleconfig.DefaultConfigTemplate
customAppTemplate := serverconfig.DefaultConfigTemplate + oracleconfig.DefaultConfigTemplate + evmservercfg.DefaultConfigTemplate
// Edit the default template file
//
// customAppTemplate := serverconfig.DefaultConfigTemplate + `
Expand Down
Loading
Loading