Documentation
¶
Index ¶
Constants ¶
const ( // DefaultAPIEnable is the default value for the parameter that defines if the cosmos REST API server is enabled DefaultAPIEnable = false // DefaultGRPCEnable is the default value for the parameter that defines if the gRPC server is enabled DefaultGRPCEnable = false // DefaultGRPCWebEnable is the default value for the parameter that defines if the gRPC web server is enabled DefaultGRPCWebEnable = false // DefaultJSONRPCEnable is the default value for the parameter that defines if the JSON-RPC server is enabled DefaultJSONRPCEnable = false // DefaultRosettaEnable is the default value for the parameter that defines if the Rosetta API server is enabled DefaultRosettaEnable = false // DefaultTelemetryEnable is the default value for the parameter that defines if the telemetry is enabled DefaultTelemetryEnable = false // DefaultGRPCAddress is the default address the gRPC server binds to. DefaultGRPCAddress = "0.0.0.0:9900" // DefaultJSONRPCAddress is the default address the JSON-RPC server binds to. DefaultJSONRPCAddress = "127.0.0.1:8545" // DefaultJSONRPCWsAddress is the default address the JSON-RPC WebSocket server binds to. DefaultJSONRPCWsAddress = "127.0.0.1:8546" // DefaultJsonRPCMetricsAddress is the default address the JSON-RPC Metrics server binds to. DefaultJSONRPCMetricsAddress = "127.0.0.1:6065" // DefaultEVMTracer is the default vm.Tracer type DefaultEVMTracer = "" // DefaultFixRevertGasRefundHeight is the default height at which to overwrite gas refund DefaultFixRevertGasRefundHeight = 0 // DefaultMaxTxGasWanted is the default gas wanted for each eth tx returned in ante handler in check tx mode DefaultMaxTxGasWanted = 0 // DefaultGasCap is the default cap on gas that can be used in eth_call/estimateGas DefaultGasCap uint64 = 25000000 // DefaultFilterCap is the default cap for total number of filters that can be created DefaultFilterCap int32 = 200 // DefaultFeeHistoryCap is the default cap for total number of blocks that can be fetched DefaultFeeHistoryCap int32 = 100 // DefaultLogsCap is the default cap of results returned from single 'eth_getLogs' query DefaultLogsCap int32 = 10000 // DefaultBlockRangeCap is the default cap of block range allowed for 'eth_getLogs' query DefaultBlockRangeCap int32 = 10000 // DefaultEVMTimeout is the default timeout for eth_call DefaultEVMTimeout = 5 * time.Second // DefaultTxFeeCap is the default tx-fee cap for sending a transaction DefaultTxFeeCap float64 = 1.0 // DefaultHTTPTimeout is the default read/write timeout of the http json-rpc server DefaultHTTPTimeout = 30 * time.Second // DefaultHTTPIdleTimeout is the default idle timeout of the http json-rpc server DefaultHTTPIdleTimeout = 120 * time.Second // DefaultAllowUnprotectedTxs value is false DefaultAllowUnprotectedTxs = false // DefaultMaxOpenConnections represents the amount of open connections (unlimited = 0) DefaultMaxOpenConnections = 0 // DefaultEnableIndexer value is false DefaultEnableIndexer = true // DefaultIndexerCacheSize value is 10000 DefaultIndexerCacheSize = 10000 // DefaultGasAdjustment value to use as default in gas-adjustment flag DefaultGasAdjustment = 1.2 // DefaultMemIAVLEnable is the default value that defines if memIAVL is enabled DefaultMemIAVLEnable = false // DefaultZeroCopy is the default value that defines if // the zero-copied slices must be retained beyond current block's execution // the sdk address cache will be disabled if zero-copy is enabled DefaultZeroCopy = false // DefaultAsyncCommitBuffer value to use as default for the size of // asynchronous commit queue when using memIAVL DefaultAsyncCommitBuffer = 0 // DefaultSnapshotKeepRecent default value for how many old snapshots // (excluding the latest one) should be kept after new snapshots // when using memIAVL DefaultSnapshotKeepRecent = 1 )
const DefaultConfigTemplate = ` ############################################################################### ### EVM Configuration ### ############################################################################### [evm] # Tracer defines the 'vm.Tracer' type that the EVM will use when the node is run in # debug mode. To enable tracing use the '--evm.tracer' flag when starting your node. # Valid types are: json|struct|access_list|markdown tracer = "{{ .EVM.Tracer }}" platform-address = "0xCDf40a96939014b1B14dE7A6aa395C3547294020,0x681a12a2e496FBe469092D7aD029fF3B8cEFaaFb" # MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode. max-tx-gas-wanted = {{ .EVM.MaxTxGasWanted }} ############################################################################### ### JSON RPC Configuration ### ############################################################################### [json-rpc] # Enable defines if the gRPC server should be enabled. enable = {{ .JSONRPC.Enable }} # Address defines the EVM RPC HTTP server address to bind to. address = "{{ .JSONRPC.Address }}" # Address defines the EVM WebSocket server address to bind to. ws-address = "{{ .JSONRPC.WsAddress }}" # API defines a list of JSON-RPC namespaces that should be enabled # Example: "eth,txpool,personal,net,debug,web3" api = "{{range $index, $elmt := .JSONRPC.API}}{{if $index}},{{$elmt}}{{else}}{{$elmt}}{{end}}{{end}}" # GasCap sets a cap on gas that can be used in eth_call/estimateGas (0=infinite). Default: 25,000,000. gas-cap = {{ .JSONRPC.GasCap }} # EVMTimeout is the global timeout for eth_call. Default: 5s. evm-timeout = "{{ .JSONRPC.EVMTimeout }}" # TxFeeCap is the global tx-fee cap for send transaction. Default: 1eth. txfee-cap = {{ .JSONRPC.TxFeeCap }} # FilterCap sets the global cap for total number of filters that can be created filter-cap = {{ .JSONRPC.FilterCap }} # FeeHistoryCap sets the global cap for total number of blocks that can be fetched feehistory-cap = {{ .JSONRPC.FeeHistoryCap }} # LogsCap defines the max number of results can be returned from single 'eth_getLogs' query. logs-cap = {{ .JSONRPC.LogsCap }} # BlockRangeCap defines the max block range allowed for 'eth_getLogs' query. block-range-cap = {{ .JSONRPC.BlockRangeCap }} # HTTPTimeout is the read/write timeout of http json-rpc server. http-timeout = "{{ .JSONRPC.HTTPTimeout }}" # HTTPIdleTimeout is the idle timeout of http json-rpc server. http-idle-timeout = "{{ .JSONRPC.HTTPIdleTimeout }}" # AllowUnprotectedTxs restricts unprotected (non EIP155 signed) transactions to be submitted via # the node's RPC when the global parameter is disabled. allow-unprotected-txs = {{ .JSONRPC.AllowUnprotectedTxs }} # MaxOpenConnections sets the maximum number of simultaneous connections # for the server listener. max-open-connections = {{ .JSONRPC.MaxOpenConnections }} # EnableIndexer enables the custom transaction indexer for the EVM (ethereum transactions). enable-indexer = {{ .JSONRPC.EnableIndexer }} # IndexerCacheSize defines the cache size. indexer-cache-size = {{ .JSONRPC.IndexerCacheSize }} # MetricsAddress defines the EVM Metrics server address to bind to. Pass --metrics in CLI to enable # Prometheus metrics path: /debug/metrics/prometheus metrics-address = "{{ .JSONRPC.MetricsAddress }}" # Upgrade height for fix of revert gas refund logic when transaction reverted. fix-revert-gas-refund-height = {{ .JSONRPC.FixRevertGasRefundHeight }} ############################################################################### ### TLS Configuration ### ############################################################################### [tls] # Certificate path defines the cert.pem file path for the TLS configuration. certificate-path = "{{ .TLS.CertificatePath }}" # Key path defines the key.pem file path for the TLS configuration. key-path = "{{ .TLS.KeyPath }}" ` + memiavlcfg.DefaultConfigTemplate
DefaultConfigTemplate defines the configuration template for the EVM RPC configuration
Variables ¶
This section is empty.
Functions ¶
func AppConfig ¶
AppConfig helps to override default appConfig template and configs. return "", nil if no custom configuration is required for the application.
func GetAPINamespaces ¶
func GetAPINamespaces() []string
GetAPINamespaces returns the all the available JSON-RPC API namespaces.
func GetDefaultAPINamespaces ¶
func GetDefaultAPINamespaces() []string
GetDefaultAPINamespaces returns the default list of JSON-RPC namespaces that should be enabled
Types ¶
type Config ¶
type Config struct {
config.Config `mapstructure:",squash"`
EVM EVMConfig `mapstructure:"evm"`
JSONRPC JSONRPCConfig `mapstructure:"json-rpc"`
TLS TLSConfig `mapstructure:"tls"`
MemIAVL MemIAVLConfig `mapstructure:"memiavl"`
}
Config defines the server's top level configuration. It includes the default app config from the SDK as well as the EVM configuration to enable the JSON-RPC APIs.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns server's default configuration.
func (Config) ValidateBasic ¶
ValidateBasic returns an error any of the application configuration fields are invalid
type EVMConfig ¶
type EVMConfig struct {
// Tracer defines vm.Tracer type that the EVM will use if the node is run in
// trace mode. Default: 'json'.
Tracer string `mapstructure:"tracer"`
// MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode.
MaxTxGasWanted uint64 `mapstructure:"max-tx-gas-wanted"`
PlatformAddress string `mapstructure:"platform-address"`
}
EVMConfig defines the application configuration values for the EVM.
func DefaultEVMConfig ¶
func DefaultEVMConfig() *EVMConfig
DefaultEVMConfig returns the default EVM configuration
type JSONRPCConfig ¶
type JSONRPCConfig struct {
// API defines a list of JSON-RPC namespaces that should be enabled
API []string `mapstructure:"api"`
// Address defines the HTTP server to listen on
Address string `mapstructure:"address"`
// WsAddress defines the WebSocket server to listen on
WsAddress string `mapstructure:"ws-address"`
// GasCap is the global gas cap for eth-call variants.
GasCap uint64 `mapstructure:"gas-cap"`
// EVMTimeout is the global timeout for eth-call.
EVMTimeout time.Duration `mapstructure:"evm-timeout"`
// TxFeeCap is the global tx-fee cap for send transaction
TxFeeCap float64 `mapstructure:"txfee-cap"`
// FilterCap is the global cap for total number of filters that can be created.
FilterCap int32 `mapstructure:"filter-cap"`
// FeeHistoryCap is the global cap for total number of blocks that can be fetched
FeeHistoryCap int32 `mapstructure:"feehistory-cap"`
// Enable defines if the EVM RPC server should be enabled.
Enable bool `mapstructure:"enable"`
// LogsCap defines the max number of results can be returned from single `eth_getLogs` query.
LogsCap int32 `mapstructure:"logs-cap"`
// BlockRangeCap defines the max block range allowed for `eth_getLogs` query.
BlockRangeCap int32 `mapstructure:"block-range-cap"`
// HTTPTimeout is the read/write timeout of http json-rpc server.
HTTPTimeout time.Duration `mapstructure:"http-timeout"`
// HTTPIdleTimeout is the idle timeout of http json-rpc server.
HTTPIdleTimeout time.Duration `mapstructure:"http-idle-timeout"`
// AllowUnprotectedTxs restricts unprotected (non EIP155 signed) transactions to be submitted via
// the node's RPC when global parameter is disabled.
AllowUnprotectedTxs bool `mapstructure:"allow-unprotected-txs"`
// MaxOpenConnections sets the maximum number of simultaneous connections
// for the server listener.
MaxOpenConnections int `mapstructure:"max-open-connections"`
// EnableIndexer defines if enable the custom indexer service.
EnableIndexer bool `mapstructure:"enable-indexer"`
// IndexerCacheSize defines the cache size.
IndexerCacheSize int `mapstructure:"indexer-cache-size"`
// MetricsAddress defines the metrics server to listen on
MetricsAddress string `mapstructure:"metrics-address"`
// FixRevertGasRefundHeight defines the upgrade height for fix of revert gas refund logic when transaction reverted
FixRevertGasRefundHeight int64 `mapstructure:"fix-revert-gas-refund-height"`
}
JSONRPCConfig defines configuration for the EVM RPC server.
func DefaultJSONRPCConfig ¶
func DefaultJSONRPCConfig() *JSONRPCConfig
DefaultJSONRPCConfig returns an EVM config with the JSON-RPC API enabled by default
func (JSONRPCConfig) Validate ¶
func (c JSONRPCConfig) Validate() error
Validate returns an error if the JSON-RPC configuration fields are invalid.
type MemIAVLConfig ¶
type MemIAVLConfig struct {
memiavlcfg.MemIAVLConfig
}
MemIAVLConfig defines the configuration for memIAVL.
func DefaultMemIAVLConfig ¶
func DefaultMemIAVLConfig() *MemIAVLConfig
DefaultMemIAVLConfig returns the default MemIAVL configuration
func (MemIAVLConfig) Validate ¶
func (c MemIAVLConfig) Validate() error
Validate returns an error if the MemIAVL configuration fields are invalid.
type TLSConfig ¶
type TLSConfig struct {
// CertificatePath the file path for the certificate .pem file
CertificatePath string `mapstructure:"certificate-path"`
// KeyPath the file path for the key .pem file
KeyPath string `mapstructure:"key-path"`
}
TLSConfig defines the certificate and matching private key for the server.
func DefaultTLSConfig ¶
func DefaultTLSConfig() *TLSConfig
DefaultTLSConfig returns the default TLS configuration