From eeaa048f0b2ba0af1f66a150b54b8eedbd358c8d Mon Sep 17 00:00:00 2001 From: dudong2 Date: Wed, 7 Aug 2024 14:31:05 +0900 Subject: [PATCH] feat: Apply code diffs --- Makefile | 4 ++-- app/app.go | 5 +++++ cmd/ethermintd/root.go | 2 ++ server/start.go | 8 ++++++++ testutil/network/util.go | 4 ++++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c258ee465b..6e42ac29d8 100755 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation') PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation') VERSION ?= $(shell echo $(shell git describe --tags `git rev-list --tags="v*" --max-count=1`) | sed 's/^v//') -TMVERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::') +TMVERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::') COMMIT := $(shell git log -1 --format='%H') LEDGER_ENABLED ?= true BINDIR ?= $(GOPATH)/bin @@ -67,7 +67,7 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=ethermint \ -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ -X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \ -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \ - -X github.com/tendermint/tendermint/version.TMCoreSemVer=$(TMVERSION) + -X github.com/cometbft/cometbft/version.TMCoreSemVer=$(TMVERSION) # DB backend selection ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS))) diff --git a/app/app.go b/app/app.go index b0a6f5455a..4d70a51d5f 100644 --- a/app/app.go +++ b/app/app.go @@ -18,6 +18,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" + nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/codec" @@ -734,6 +735,10 @@ func (app *EthermintApp) RegisterTendermintService(clientCtx client.Context) { tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry) } +func (app *EthermintApp) RegisterNodeService(clientCtx client.Context) { + nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) +} + // RegisterSwaggerAPI registers swagger route with API Server func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router) { statikFS, err := fs.New() diff --git a/cmd/ethermintd/root.go b/cmd/ethermintd/root.go index 0470d5d934..9744cad80e 100644 --- a/cmd/ethermintd/root.go +++ b/cmd/ethermintd/root.go @@ -234,6 +234,8 @@ func (a appCreator) newApp(logger tmlog.Logger, db dbm.DB, traceStore io.Writer, baseapp.SetSnapshotStore(snapshotStore), baseapp.SetSnapshotInterval(cast.ToUint64(appOpts.Get(sdkserver.FlagStateSyncSnapshotInterval))), baseapp.SetSnapshotKeepRecent(cast.ToUint32(appOpts.Get(sdkserver.FlagStateSyncSnapshotKeepRecent))), + baseapp.SetIAVLCacheSize(cast.ToInt(appOpts.Get(sdkserver.FlagIAVLCacheSize))), + baseapp.SetIAVLDisableFastNode(cast.ToBool(appOpts.Get(sdkserver.FlagDisableIAVLFastNode))), ) return ethermintApp diff --git a/server/start.go b/server/start.go index 7354fd0118..21f4bd8ff0 100644 --- a/server/start.go +++ b/server/start.go @@ -179,6 +179,8 @@ which accepts a path for the resulting pprof file. cmd.Flags().Uint64(server.FlagStateSyncSnapshotInterval, 0, "State sync snapshot interval") cmd.Flags().Uint32(server.FlagStateSyncSnapshotKeepRecent, 2, "State sync snapshot to keep") + cmd.Flags().Bool(server.FlagDisableIAVLFastNode, true, "Disable fast node for IAVL tree") + // add support for all Tendermint-specific command line options tcmd.AddNodeFlags(cmd) return cmd @@ -331,10 +333,16 @@ func startInProcess(ctx *server.Context, clientCtx client.Context, appCreator ty // service if API or gRPC or JSONRPC is enabled, and avoid doing so in the general // case, because it spawns a new local tendermint RPC client. if config.API.Enable || config.GRPC.Enable || config.JSONRPC.Enable || config.JSONRPC.EnableIndexer { + // re-assign for making the client available below + // do not use := to avoid shadowing clientCtx clientCtx = clientCtx.WithClient(local.New(tmNode)) app.RegisterTxService(clientCtx) app.RegisterTendermintService(clientCtx) + + if a, ok := app.(types.ApplicationQueryService); ok { + a.RegisterNodeService(clientCtx) + } } var idxer ethermint.EVMTxIndexer diff --git a/testutil/network/util.go b/testutil/network/util.go index 45d0bc42f1..766550adec 100644 --- a/testutil/network/util.go +++ b/testutil/network/util.go @@ -83,6 +83,10 @@ func startInProcess(cfg Config, val *Validator) error { // Add the tendermint queries service in the gRPC router. app.RegisterTendermintService(val.ClientCtx) + + if a, ok := app.(srvtypes.ApplicationQueryService); ok { + a.RegisterNodeService(val.ClientCtx) + } } if val.AppConfig.API.Enable && val.APIAddress != "" {