Skip to content

Commit

Permalink
feat: Apply code diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
dudong2 committed Aug 7, 2024
1 parent 3e786bd commit eeaa048
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)))
Expand Down
5 changes: 5 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions cmd/ethermintd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions testutil/network/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand Down

0 comments on commit eeaa048

Please sign in to comment.