From 386e53c0aef81591614705c7724792471dbd66e5 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Wed, 30 Oct 2024 15:37:04 +0800 Subject: [PATCH 1/3] Problem: build fail without cgo --- CHANGELOG.md | 1 + app/ante/eip712.go | 5 ++--- go.mod | 2 +- go.sum | 4 ++-- gomod2nix.toml | 4 ++-- server/start.go | 9 ++++++++- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d79471d745..722c05d449 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -98,6 +98,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#526](https://github.com/crypto-org-chain/ethermint/pull/526), [#535](https://github.com/crypto-org-chain/ethermint/pull/535) Avoid unnecessary block result in header related api call. * [#533](https://github.com/crypto-org-chain/ethermint/pull/533) Bump cosmos-sdk to v0.50.10, cometbft to v0.38.13 and ibc-go to v8.5.1. * [#546](https://github.com/crypto-org-chain/ethermint/pull/546) Introduce `--async-check-tx` flag to run check-tx async with consensus. +* [#]() Support build without cgo. ## v0.21.x-cronos diff --git a/app/ante/eip712.go b/app/ante/eip712.go index 2237a7910c..3ccef365f7 100644 --- a/app/ante/eip712.go +++ b/app/ante/eip712.go @@ -32,7 +32,6 @@ import ( ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" ethcrypto "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/secp256k1" "github.com/ethereum/go-ethereum/signer/core/apitypes" "github.com/evmos/ethermint/crypto/ethsecp256k1" "github.com/evmos/ethermint/ethereum/eip712" @@ -301,7 +300,7 @@ func VerifySignature( feePayerSig[ethcrypto.RecoveryIDOffset] -= 27 } - feePayerPubkey, err := secp256k1.RecoverPubkey(sigHash, feePayerSig) + feePayerPubkey, err := ethcrypto.Ecrecover(sigHash, feePayerSig) if err != nil { return errorsmod.Wrap(err, "failed to recover delegated fee payer from sig") } @@ -327,7 +326,7 @@ func VerifySignature( // VerifySignature of ethsecp256k1 accepts 64 byte signature [R||S] // WARNING! Under NO CIRCUMSTANCES try to use pubKey.VerifySignature there - if !secp256k1.VerifySignature(pubKey.Bytes(), sigHash, feePayerSig[:len(feePayerSig)-1]) { + if !ethcrypto.VerifySignature(pubKey.Bytes(), sigHash, feePayerSig[:len(feePayerSig)-1]) { return errorsmod.Wrap(errortypes.ErrorInvalidSigner, "unable to verify signer signature of EIP712 typed data") } diff --git a/go.mod b/go.mod index e5ba5c2de9..136ce83dc2 100644 --- a/go.mod +++ b/go.mod @@ -254,7 +254,7 @@ replace ( // use cosmos keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // release/v1.11.x - github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a + github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20241030073450-b9cc632bc183 // Fix upstream GHSA-h395-qcrw-5vmq vulnerability. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 diff --git a/go.sum b/go.sum index 47d297cd9b..c2411241b5 100644 --- a/go.sum +++ b/go.sum @@ -420,8 +420,8 @@ github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241015015202-783e224f9517 h github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241015015202-783e224f9517/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= github.com/crypto-org-chain/go-block-stm v0.0.0-20240919080136-6c49aef68716 h1:OvD5Rm0B6LHUJk6z858UgwdP72jU2DuUdXeclRyKpDI= github.com/crypto-org-chain/go-block-stm v0.0.0-20240919080136-6c49aef68716/go.mod h1:iwQTX9xMX8NV9k3o2BiWXA0SswpsZrDk5q3gA7nWYiE= -github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a h1:IUPD+dg1YQl8cLocxQ/Mbx/ObTgAgcrZlcBhFjsLO40= -github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a/go.mod h1:A249HEl6XyiV5zSnKM9j9RF3szMghMNONMyNvYuqQIw= +github.com/crypto-org-chain/go-ethereum v1.10.20-0.20241030073450-b9cc632bc183 h1:JDBTqDkd9X9oBF2C4FKOpn0GVDQDzVkHzeS8eDWNl6A= +github.com/crypto-org-chain/go-ethereum v1.10.20-0.20241030073450-b9cc632bc183/go.mod h1:5DnkptqPQr+Mo3sy/2V3OQu+K94x1PVzFGZJZbDF8mI= github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE= github.com/danieljoos/wincred v1.2.0/go.mod h1:FzQLLMKBFdvu+osBrnFODiv32YGwCfx0SkRa/eYHgec= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/gomod2nix.toml b/gomod2nix.toml index 4fb382514d..03fa4cc785 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -249,8 +249,8 @@ schema = 3 version = "v1.6.1" hash = "sha256-zOpoaepCfPLmU9iQji/Ait+SVEHI9eF3rwtW0h/8lho=" [mod."github.com/ethereum/go-ethereum"] - version = "v1.10.20-0.20240926023215-d2275b4afb9a" - hash = "sha256-ozwVS2BhAoz+OOisAyMhgg+lq8FdQjf90xoOq9cxtGw=" + version = "v1.10.20-0.20241030073450-b9cc632bc183" + hash = "sha256-5nh0HZOZwlZBMmHv08BELlNfDZyq5zwq65ByyMzOetA=" replaced = "github.com/crypto-org-chain/go-ethereum" [mod."github.com/fatih/color"] version = "v1.16.0" diff --git a/server/start.go b/server/start.go index 8d5bca5e29..4ab2962454 100644 --- a/server/start.go +++ b/server/start.go @@ -22,6 +22,7 @@ import ( "net" "os" "path/filepath" + "runtime" "runtime/pprof" "github.com/cosmos/cosmos-sdk/codec" @@ -69,7 +70,10 @@ import ( ethermint "github.com/evmos/ethermint/types" ) -const FlagAsyncCheckTx = "async-check-tx" +const ( + FlagAsyncCheckTx = "async-check-tx" + FlagBlockProfileRate = "block-profile-rate" +) // DBOpener is a function to open `application.db`, potentially with customized options. type DBOpener func(opts types.AppOptions, rootDir string, backend dbm.BackendType) (dbm.DB, error) @@ -230,6 +234,7 @@ which accepts a path for the resulting pprof file. cmd.Flags().Int(server.FlagMempoolMaxTxs, config.DefaultMaxTxs, "Sets MaxTx value for the app-side mempool") cmd.Flags().Bool(FlagAsyncCheckTx, false, "Enable async check tx [experimental]") + cmd.Flags().Int(FlagBlockProfileRate, 0, "Set block profile sample rate") // add support for all CometBFT-specific command line options tcmd.AddNodeFlags(cmd) @@ -302,6 +307,8 @@ func startStandAlone(svrCtx *server.Context, opts StartOptions) error { // legacyAminoCdc is used for the legacy REST API func startInProcess(svrCtx *server.Context, clientCtx client.Context, opts StartOptions) (err error) { + runtime.SetBlockProfileRate(svrCtx.Viper.GetInt(FlagBlockProfileRate)) + cfg := svrCtx.Config home := cfg.RootDir logger := svrCtx.Logger From 66444d4196b700caa6b7e99b92dc1fb83d3dd021 Mon Sep 17 00:00:00 2001 From: yihuang Date: Wed, 30 Oct 2024 15:38:50 +0800 Subject: [PATCH 2/3] Update CHANGELOG.md Signed-off-by: yihuang --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 722c05d449..a9e82a4c87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -98,7 +98,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#526](https://github.com/crypto-org-chain/ethermint/pull/526), [#535](https://github.com/crypto-org-chain/ethermint/pull/535) Avoid unnecessary block result in header related api call. * [#533](https://github.com/crypto-org-chain/ethermint/pull/533) Bump cosmos-sdk to v0.50.10, cometbft to v0.38.13 and ibc-go to v8.5.1. * [#546](https://github.com/crypto-org-chain/ethermint/pull/546) Introduce `--async-check-tx` flag to run check-tx async with consensus. -* [#]() Support build without cgo. +* [#549](https://github.com/crypto-org-chain/ethermint/pull/549) Support build without cgo. ## v0.21.x-cronos From 7f2d8616453f5e70b913b5de76966ce089de0c86 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Wed, 30 Oct 2024 15:39:17 +0800 Subject: [PATCH 3/3] revert --- server/start.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/server/start.go b/server/start.go index 4ab2962454..8d5bca5e29 100644 --- a/server/start.go +++ b/server/start.go @@ -22,7 +22,6 @@ import ( "net" "os" "path/filepath" - "runtime" "runtime/pprof" "github.com/cosmos/cosmos-sdk/codec" @@ -70,10 +69,7 @@ import ( ethermint "github.com/evmos/ethermint/types" ) -const ( - FlagAsyncCheckTx = "async-check-tx" - FlagBlockProfileRate = "block-profile-rate" -) +const FlagAsyncCheckTx = "async-check-tx" // DBOpener is a function to open `application.db`, potentially with customized options. type DBOpener func(opts types.AppOptions, rootDir string, backend dbm.BackendType) (dbm.DB, error) @@ -234,7 +230,6 @@ which accepts a path for the resulting pprof file. cmd.Flags().Int(server.FlagMempoolMaxTxs, config.DefaultMaxTxs, "Sets MaxTx value for the app-side mempool") cmd.Flags().Bool(FlagAsyncCheckTx, false, "Enable async check tx [experimental]") - cmd.Flags().Int(FlagBlockProfileRate, 0, "Set block profile sample rate") // add support for all CometBFT-specific command line options tcmd.AddNodeFlags(cmd) @@ -307,8 +302,6 @@ func startStandAlone(svrCtx *server.Context, opts StartOptions) error { // legacyAminoCdc is used for the legacy REST API func startInProcess(svrCtx *server.Context, clientCtx client.Context, opts StartOptions) (err error) { - runtime.SetBlockProfileRate(svrCtx.Viper.GetInt(FlagBlockProfileRate)) - cfg := svrCtx.Config home := cfg.RootDir logger := svrCtx.Logger