Documentation ¶
Overview ¶
Copyright 2021 Evmos Foundation This file is part of Evmos' Ethermint library.
The Ethermint library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The Ethermint library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
Copyright 2021 Evmos Foundation This file is part of Evmos' Ethermint library.
The Ethermint library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The Ethermint library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
Copyright 2021 Evmos Foundation This file is part of Evmos' Ethermint library.
The Ethermint library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The Ethermint library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
Copyright 2021 Evmos Foundation This file is part of Evmos' Ethermint library.
The Ethermint library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The Ethermint library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
Index ¶
- Constants
- func AddCommands(rootCmd *cobra.Command, defaultNodeHome string, appCreator types.AppCreator, ...)
- func ConnectTmWS(tmRPCAddr, tmEndpoint string, logger tmlog.Logger) *rpcclient.WSClient
- func DefaultDBProvider(ctx *DBContext) (dbm.DB, error)
- func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Command
- func ExternalIP() (string, error)
- func GetAppDBBackend(opts types.AppOptions) dbm.BackendType
- func GetPruningOptionsFromFlags(appOpts types.AppOptions) (storetypes.PruningOptions, error)
- func GetServerContextFromCmd(cmd *cobra.Command) *server.Context
- func InterceptConfigs(cmd *cobra.Command) (*tmcfg.Config, error)
- func InterceptConfigsPreRunHandler(cmd *cobra.Command, customAppConfigTemplate string, ...) error
- func LatestVersionCmd(defaultNodeHome string) *cobra.Command
- func Listen(addr string, config *config.Config) (net.Listener, error)
- func MountGRPCWebServices(router *mux.Router, grpcWeb *grpcweb.WrappedGrpcServer, grpcResources []string, ...)
- func NewContext(v *viper.Viper, config *tmcfg.Config, logger tmlog.Logger) *server.Context
- func NewDefaultContext() *server.Context
- func NewIndexTxCmd() *cobra.Command
- func NewRollbackCmd(appCreator types.AppCreator, defaultNodeHome string) *cobra.Command
- func OpenDB(rootDir string) (dbm.DB, error)
- func OpenIndexerDB(rootDir string, backendType dbm.BackendType) (dbm.DB, error)
- func SetCmdServerContext(cmd *cobra.Command, serverCtx *server.Context) error
- func ShowAddressCmd() *cobra.Command
- func ShowNodeIDCmd() *cobra.Command
- func ShowValidatorCmd() *cobra.Command
- func StartCmd(appCreator types.AppCreator, defaultNodeHome string, ...) *cobra.Command
- func StartJSONRPC(ctx *servercosmos.Context, clientCtx client.Context, ...) (*http.Server, chan struct{}, error)
- func StartJSONRPCInProcess(ctx *servercosmos.Context, clientCtx client.Context) (err error)
- func TrapSignal(cleanupFunc func())
- func VersionCmd() *cobra.Command
- type DBContext
- type EVMIndexerService
- type ErrorCode
- type GenesisDocProvider
- type ZeroLogWrapper
Constants ¶
const ( FlagHeight = "height" FlagForZeroHeight = "for-zero-height" FlagJailAllowedAddrs = "jail-allowed-addrs" )
const ( ServiceName = "EVMIndexerService" NewBlockWaitTimeout = 60 * time.Second )
const ( FlagMinGasPrices = "minimum-gas-prices" FlagHaltHeight = "halt-height" FlagHaltTime = "halt-time" FlagInterBlockCache = "inter-block-cache" FlagUnsafeSkipUpgrades = "unsafe-skip-upgrades" FlagTrace = "trace" FlagProfile = "profile" FlagInvCheckPeriod = "inv-check-period" FlagPruning = "pruning" FlagPruningKeepRecent = "pruning-keep-recent" FlagPruningKeepEvery = "pruning-keep-every" FlagPruningInterval = "pruning-interval" FlagIndexEvents = "index-events" FlagMinRetainBlocks = "min-retain-blocks" FlagIAVLCacheSize = "iavl-cache-size" FlagIAVLFastNode = "iavl-disable-fastnode" FlagCompactionInterval = "compaction-interval" FlagNoVersioning = "no-versioning" // state sync-related flags FlagStateSyncSnapshotInterval = "state-sync.snapshot-interval" FlagStateSyncSnapshotKeepRecent = "state-sync.snapshot-keep-recent" // archival related flags FlagArchivalVersion = "archival-version" FlagArchivalDBType = "archival-db-type" FlagArchivalArweaveIndexDBFullPath = "archival-arweave-index-db-full-path" FlagArchivalArweaveNodeURL = "archival-arweave-node-url" // chain info FlagChainID = "chain-id" )
const RestartErrorCode = 100
Error code reserved for signalled
const ServerContextKey = sdk.ContextKey("server.context")
ServerContextKey defines the context key used to retrieve a server.Context from a command's Context.
Variables ¶
This section is empty.
Functions ¶
func AddCommands ¶
func AddCommands( rootCmd *cobra.Command, defaultNodeHome string, appCreator types.AppCreator, appExport types.AppExporter, addStartFlags types.ModuleInitFlags, tracerProviderOptions []trace.TracerProviderOption, )
add server commands
func ConnectTmWS ¶
func DefaultDBProvider ¶
DefaultDBProvider returns a database using the DBBackend and DBDir specified in the ctx.Config.
func ExportCmd ¶
func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Command
ExportCmd dumps app state to JSON.
func ExternalIP ¶
https://stackoverflow.com/questions/23558425/how-do-i-get-the-local-ip-address-in-go TODO there must be a better way to get external IP
func GetAppDBBackend ¶
func GetAppDBBackend(opts types.AppOptions) dbm.BackendType
GetAppDBBackend gets the backend type to use for the application DBs.
func GetPruningOptionsFromFlags ¶
func GetPruningOptionsFromFlags(appOpts types.AppOptions) (storetypes.PruningOptions, error)
GetPruningOptionsFromFlags parses command flags and returns the correct PruningOptions. If a pruning strategy is provided, that will be parsed and returned, otherwise, it is assumed custom pruning options are provided.
func GetServerContextFromCmd ¶
GetServerContextFromCmd returns a Context from a command or an empty Context if it has not been set.
func InterceptConfigsPreRunHandler ¶
func InterceptConfigsPreRunHandler(cmd *cobra.Command, customAppConfigTemplate string, customAppConfig interface{}) error
InterceptConfigsPreRunHandler performs a pre-run function for the root daemon application command. It will create a Viper literal and a default server Context. The server Tendermint configuration will either be read and parsed or created and saved to disk, where the server Context is updated to reflect the Tendermint configuration. It takes custom app config template and config settings to create a custom Tendermint configuration. If the custom template is empty, it uses default-template provided by the server. The Viper literal is used to read and parse the application configuration. Command handlers can fetch the server Context to get the Tendermint configuration or to get access to Viper.
func LatestVersionCmd ¶
LatestVersionCmd returns the latest version of the application DB
func Listen ¶
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 NewContext ¶
func NewDefaultContext ¶
func NewIndexTxCmd ¶
func NewRollbackCmd ¶
func NewRollbackCmd(appCreator types.AppCreator, defaultNodeHome string) *cobra.Command
NewRollbackCmd creates a command to rollback tendermint and multistore state by one height.
func OpenIndexerDB ¶
OpenIndexerDB opens the custom eth indexer db, using the same db backend as the main app
func SetCmdServerContext ¶
SetCmdServerContext sets a command's Context value to the provided argument.
func ShowAddressCmd ¶
ShowAddressCmd - show this node's validator address
func ShowNodeIDCmd ¶
ShowNodeIDCmd - ported from Tendermint, dump node ID to stdout
func ShowValidatorCmd ¶
ShowValidatorCmd - ported from Tendermint, show this node's validator info
func StartCmd ¶
func StartCmd(appCreator types.AppCreator, defaultNodeHome string, tracerProviderOptions []trace.TracerProviderOption) *cobra.Command
StartCmd runs the service passed in, either stand-alone or in-process with Tendermint.
func StartJSONRPC ¶
func StartJSONRPC(ctx *servercosmos.Context, clientCtx client.Context, tmRPCAddr, tmEndpoint string, config *config.Config, indexer ethermint.EVMTxIndexer, ) (*http.Server, chan struct{}, error)
StartJSONRPC starts the JSON-RPC server
func StartJSONRPCInProcess ¶
func StartJSONRPCInProcess(ctx *servercosmos.Context, clientCtx client.Context) (err error)
StartJSONRPCInProcess 添加 JSON-RPC 接口
func TrapSignal ¶
func TrapSignal(cleanupFunc func())
TrapSignal traps SIGINT and SIGTERM and terminates the server correctly.
func VersionCmd ¶
VersionCmd prints tendermint and ABCI version numbers.
Types ¶
type EVMIndexerService ¶
type EVMIndexerService struct { service.BaseService Logger log.Logger // contains filtered or unexported fields }
EVMIndexerService indexes transactions for json-rpc service.
func NewEVMIndexerService ¶
func NewEVMIndexerService( txIdxr ethermint.EVMTxIndexer, client rpcclient.Client, ) *EVMIndexerService
NewEVMIndexerService returns a new service instance.
func (*EVMIndexerService) OnStart ¶
func (eis *EVMIndexerService) OnStart(ctx context.Context) error
OnStart implements service.Service by subscribing for new blocks and indexing them by events.
func (*EVMIndexerService) OnStop ¶
func (eis *EVMIndexerService) OnStop()
func (*EVMIndexerService) SetLogger ¶
func (eis *EVMIndexerService) SetLogger(l log.Logger)
SetLogger implements Service by setting a logger.
type ErrorCode ¶
type ErrorCode struct {
Code int
}
ErrorCode contains the exit code for server exit.
type GenesisDocProvider ¶
type GenesisDocProvider func() (*tmtypes.GenesisDoc, error)
GenesisDocProvider returns a GenesisDoc. It allows the GenesisDoc to be pulled from sources other than the filesystem, for instance from a distributed key-value store cluster.
func DefaultGenesisDocProviderFunc ¶
func DefaultGenesisDocProviderFunc(config *tmcfg.Config) GenesisDocProvider
DefaultGenesisDocProviderFunc returns a GenesisDocProvider that loads the GenesisDoc from the config.GenesisFile() on the filesystem.
type ZeroLogWrapper ¶
ZeroLogWrapper provides a wrapper around a zerolog.Logger instance. It implements Tendermint's Logger interface.
func (ZeroLogWrapper) Debug ¶
func (z ZeroLogWrapper) Debug(msg string, keyVals ...interface{})
Debug implements Tendermint's Logger interface and logs with level DEBUG. A set of key/value tuples may be provided to add context to the log. The number of tuples must be even and the key of the tuple must be a string.
func (ZeroLogWrapper) Error ¶
func (z ZeroLogWrapper) Error(msg string, keyVals ...interface{})
Error implements Tendermint's Logger interface and logs with level ERR. A set of key/value tuples may be provided to add context to the log. The number of tuples must be even and the key of the tuple must be a string.
func (ZeroLogWrapper) Info ¶
func (z ZeroLogWrapper) Info(msg string, keyVals ...interface{})
Info implements Tendermint's Logger interface and logs with level INFO. A set of key/value tuples may be provided to add context to the log. The number of tuples must be even and the key of the tuple must be a string.
func (ZeroLogWrapper) With ¶
func (z ZeroLogWrapper) With(keyVals ...interface{}) tmlog.Logger
With returns a new wrapped logger with additional context provided by a set of key/value tuples. The number of tuples must be even and the key of the tuple must be a string.