server

package
v0.0.0-...-2037a57 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2025 License: MIT Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceName = "EVMIndexerService"

	NewBlockWaitTimeout = 60 * time.Second
)
View Source
const (

	// DefaultTimeoutProposeDelta How much timeout_propose increases with each round
	DefaultTimeoutProposeDelta = 200 * time.Millisecond

	// DefaultTimeoutPrevoteDelta How much the timeout_prevote increases with each round
	DefaultTimeoutPrevoteDelta = 200 * time.Millisecond

	// DefaultTimeoutPrecommitDelta How much the timeout_precommit increases with each round
	DefaultTimeoutPrecommitDelta = 200 * time.Millisecond

	FlagSkipConfigOverwrite = "skip-config-overwrite"
)

REF: https://github.com/zeta-chain/node/issues/4032

Variables

This section is empty.

Functions

func AddCommands

func AddCommands(
	rootCmd *cobra.Command,
	opts StartOptions,
	appExport types.AppExporter,
	addStartFlags types.ModuleInitFlags,
)

AddCommands adds server commands

func ConnectTmWS

func ConnectTmWS(tmRPCAddr, tmEndpoint string, logger log.Logger) *rpcclient.WSClient

ConnectTmWS connects to a Tendermint WebSocket (WS) server. Parameters: - tmRPCAddr: The RPC address of the Tendermint server. - tmEndpoint: The WebSocket endpoint on the Tendermint server. - logger: A logger instance used to log debug and error messages.

func GenDocProvider

func GenDocProvider(cfg *cmtcfg.Config) func() (*cmttypes.GenesisDoc, error)

GenDocProvider returns a function which returns the genesis doc from the genesis file.

func Listen

func Listen(addr string, config *config.Config) (net.Listener, error)

Listen starts a net.Listener on the tcp network on the given address. If there is a specified MaxOpenConnections in the config, it will also set the limitListener.

func MountGRPCWebServices

func MountGRPCWebServices(
	router *mux.Router,
	grpcWeb *grpcweb.WrappedGrpcServer,
	grpcResources []string,
	logger log.Logger,
)

MountGRPCWebServices mounts gRPC-Web services on specific HTTP POST routes. Parameters: - router: The HTTP router instance to mount the routes on (using mux.Router). - grpcWeb: The wrapped gRPC-Web server that will handle incoming gRPC-Web and WebSocket requests. - grpcResources: A list of resource endpoints (URLs) that should be mounted for gRPC-Web POST requests. - logger: A logger instance used to log information about the mounted resources.

func NewIndexTxCmd

func NewIndexTxCmd() *cobra.Command

NewIndexTxCmd creates a new Cobra command to index historical Ethereum transactions.

func OpenIndexerDB

func OpenIndexerDB(rootDir string, backendType dbm.BackendType) (dbm.DB, error)

OpenIndexerDB opens the custom eth indexer db, using the same db backend as the main app

func StartCmd

func StartCmd(opts StartOptions) *cobra.Command

StartCmd runs the service passed in, either stand-alone or in-process with CometBFT.

func StartJSONRPC

func StartJSONRPC(ctx *server.Context,
	clientCtx client.Context,
	tmRPCAddr,
	tmEndpoint string,
	config *serverconfig.Config,
	indexer cosmosevmtypes.EVMTxIndexer,
) (*http.Server, chan struct{}, error)

StartJSONRPC starts the JSON-RPC server

Types

type CustomSlogHandler

type CustomSlogHandler struct {
	// contains filtered or unexported fields
}

CustomSlogHandler bridges Geth's slog logs to the existing Cosmos SDK logger.

func (*CustomSlogHandler) Enabled

func (h *CustomSlogHandler) Enabled(_ context.Context, _ slog.Level) bool

Enabled determines if the handler should log a given level.

func (*CustomSlogHandler) Handle

Handle processes slog records and forwards them to your Cosmos SDK logger.

func (*CustomSlogHandler) WithAttrs

func (h *CustomSlogHandler) WithAttrs(_ []slog.Attr) slog.Handler

WithAttrs allows adding additional attributes.

func (*CustomSlogHandler) WithGroup

func (h *CustomSlogHandler) WithGroup(_ string) slog.Handler

WithGroup is required to implement slog.Handler (not used).

type DBOpener

type DBOpener func(opts types.AppOptions, rootDir string, backend dbm.BackendType) (dbm.DB, error)

DBOpener is a function to open `application.db`, potentially with customized options.

type EVMIndexerService

type EVMIndexerService struct {
	service.BaseService
	// contains filtered or unexported fields
}

EVMIndexerService indexes transactions for json-rpc service.

func NewEVMIndexerService

func NewEVMIndexerService(
	txIdxr cosmosevmtypes.EVMTxIndexer,
	client rpcclient.Client,
) *EVMIndexerService

NewEVMIndexerService returns a new service instance.

func (*EVMIndexerService) OnStart

func (eis *EVMIndexerService) OnStart() error

OnStart implements service.Service by subscribing for new blocks and indexing them by events.

type StartOptions

type StartOptions struct {
	AppCreator      types.AppCreator
	DefaultNodeHome string
	DBOpener        DBOpener
}

StartOptions defines options that can be customized in `StartCmd`

func NewDefaultStartOptions

func NewDefaultStartOptions(appCreator types.AppCreator, defaultNodeHome string) StartOptions

NewDefaultStartOptions use the default db opener provided in tm-db.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL