From 0f5b1aa9297854086a3ca3aa760005a1f9ba2238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Kunze=20K=C3=BCllmer?= <31522760+fedekunze@users.noreply.github.com> Date: Thu, 17 Feb 2022 11:34:58 -0300 Subject: [PATCH 1/2] deps: bump IBC v3-rc0 (#947) * deps: bump IBC v3-rc0 * rm strict --- .mergify.yml | 1 - go.mod | 2 +- go.sum | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.mergify.yml b/.mergify.yml index d1c5c6997a..749cc4a724 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -14,7 +14,6 @@ pull_request_rules: name: default merge: method: squash - strict: true commit_message: title+body - name: backport patches to v0.9.x branch conditions: diff --git a/go.mod b/go.mod index 13d4772992..46b26f84e7 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/cosmos/cosmos-sdk v0.45.1 github.com/cosmos/go-bip39 v1.0.0 - github.com/cosmos/ibc-go/v3 v3.0.0-beta1 + github.com/cosmos/ibc-go/v3 v3.0.0-rc0 github.com/davecgh/go-spew v1.1.1 github.com/ethereum/go-ethereum v1.10.15 github.com/gogo/protobuf v1.3.3 diff --git a/go.sum b/go.sum index eecdf6fec6..6b450df51c 100644 --- a/go.sum +++ b/go.sum @@ -236,6 +236,8 @@ github.com/cosmos/iavl v0.17.3 h1:s2N819a2olOmiauVa0WAhoIJq9EhSXE9HDBAoR9k+8Y= github.com/cosmos/iavl v0.17.3/go.mod h1:prJoErZFABYZGDHka1R6Oay4z9PrNeFFiMKHDAMOi4w= github.com/cosmos/ibc-go/v3 v3.0.0-beta1 h1:VyLAJLWtDnWlbXKh0MiO9bQF244X1RcrA9mW503zFlc= github.com/cosmos/ibc-go/v3 v3.0.0-beta1/go.mod h1:Gxl50rqoJemz7NQ/GNb+m0/U+VNxchMEkq5pMmFEfkk= +github.com/cosmos/ibc-go/v3 v3.0.0-rc0 h1:kQtRMiibviP99ySdmKb8pFkbDt+JQSnW4Swh1NYf0lg= +github.com/cosmos/ibc-go/v3 v3.0.0-rc0/go.mod h1:0G/3QhYWebySAQQgBgQ4y4rqu/UmO3y9ibies3wzpsg= github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU= github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76/go.mod h1:0mkLWIoZuQ7uBoospo5Q9zIpqq6rYCPJDSUdeCJvPM8= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= From dcd2891b7341b265f6207719b942c80a1d6fdf2a Mon Sep 17 00:00:00 2001 From: yihuang Date: Sat, 19 Feb 2022 08:49:34 +0800 Subject: [PATCH 2/2] imp: redirect go-ethereum's logs to cosmos logger (#948) * redirect go-ethereum's logs to cosmos logger Closes: #862 Map go-ethereum's log levels to cosmos ones: trace -> debug debug -> debug info -> info warn -> info error -> error crit -> error * changelog * Apply suggestions from code review * Apply suggestions from code review --- CHANGELOG.md | 6 ++++++ server/json_rpc.go | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82e94a0d9b..39c64d9e3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog +## Unreleased + +### Improvements + +- (log) [#948](https://github.com/tharsis/ethermint/pull/948) redirect go-ethereum's logs to cosmos-sdk logger. + ## [v0.10.0-beta1] - 2022-02-15 ### API Breaking diff --git a/server/json_rpc.go b/server/json_rpc.go index 315cc850dc..4c893d714e 100644 --- a/server/json_rpc.go +++ b/server/json_rpc.go @@ -10,6 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/server/types" + ethlog "github.com/ethereum/go-ethereum/log" ethrpc "github.com/ethereum/go-ethereum/rpc" "github.com/tharsis/ethermint/rpc" @@ -20,6 +21,19 @@ import ( func StartJSONRPC(ctx *server.Context, clientCtx client.Context, tmRPCAddr, tmEndpoint string, config config.Config) (*http.Server, chan struct{}, error) { tmWsClient := ConnectTmWS(tmRPCAddr, tmEndpoint, ctx.Logger) + logger := ctx.Logger.With("module", "geth") + ethlog.Root().SetHandler(ethlog.FuncHandler(func(r *ethlog.Record) error { + switch r.Lvl { + case ethlog.LvlTrace, ethlog.LvlDebug: + logger.Debug(r.Msg, r.Ctx...) + case ethlog.LvlInfo, ethlog.LvlWarn: + logger.Info(r.Msg, r.Ctx...) + case ethlog.LvlError, ethlog.LvlCrit: + logger.Error(r.Msg, r.Ctx...) + } + return nil + })) + rpcServer := ethrpc.NewServer() rpcAPIArr := config.JSONRPC.API