Skip to content

Commit

Permalink
Problem: build fail without cgo
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Oct 30, 2024
1 parent ce5773e commit 386e53c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions app/ante/eip712.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
}
Expand All @@ -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")
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
4 changes: 2 additions & 2 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 8 additions & 1 deletion server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"net"
"os"
"path/filepath"
"runtime"
"runtime/pprof"

"github.com/cosmos/cosmos-sdk/codec"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 386e53c

Please sign in to comment.