Sync from fork #74
2
.github/workflows/semgrep.yml
vendored
2
.github/workflows/semgrep.yml
vendored
@ -32,7 +32,7 @@ jobs:
|
||||
go.mod
|
||||
go.sum
|
||||
- uses: actions/checkout@v3
|
||||
- run: semgrep scan --sarif --output=semgrep.sarif
|
||||
- run: semgrep scan --sarif --output=semgrep.sarif --config auto
|
||||
env:
|
||||
# Upload findings to GitHub Advanced Security Dashboard [step 1/2]
|
||||
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
|
||||
|
@ -60,6 +60,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* (ledger) [#1277](https://github.com/evmos/ethermint/pull/1277) Add Ledger preprocessing transaction hook for EIP-712-signed Cosmos payloads.
|
||||
* (rpc) [#1296](https://github.com/evmos/ethermint/pull/1296) Add RPC Backend unit tests.
|
||||
* (rpc) [#1352](https://github.com/evmos/ethermint/pull/1352) Make the grpc queries run concurrently, don't block the consensus state machine.
|
||||
* (rpc) [#1378](https://github.com/evmos/ethermint/pull/1378) Add support for EVM RPC metrics
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
@ -25,6 +25,9 @@ const (
|
||||
// DefaultJSONRPCWsAddress is the default address the JSON-RPC WebSocket server binds to.
|
||||
DefaultJSONRPCWsAddress = "0.0.0.0:8546"
|
||||
|
||||
// DefaultJsonRPCMetricsAddress is the default address the JSON-RPC Metrics server binds to.
|
||||
DefaultJSONRPCMetricsAddress = "0.0.0.0:6065"
|
||||
|
||||
// DefaultEVMTracer is the default vm.Tracer type
|
||||
DefaultEVMTracer = ""
|
||||
|
||||
@ -110,6 +113,8 @@ type JSONRPCConfig struct {
|
||||
MaxOpenConnections int `mapstructure:"max-open-connections"`
|
||||
// EnableIndexer defines if enable the custom indexer service.
|
||||
EnableIndexer bool `mapstructure:"enable-indexer"`
|
||||
// MetricsAddress defines the metrics server to listen on
|
||||
MetricsAddress string `mapstructure:"metrics-address"`
|
||||
}
|
||||
|
||||
// TLSConfig defines the certificate and matching private key for the server.
|
||||
@ -211,6 +216,7 @@ func DefaultJSONRPCConfig() *JSONRPCConfig {
|
||||
AllowUnprotectedTxs: DefaultAllowUnprotectedTxs,
|
||||
MaxOpenConnections: DefaultMaxOpenConnections,
|
||||
EnableIndexer: false,
|
||||
MetricsAddress: DefaultJSONRPCMetricsAddress,
|
||||
}
|
||||
}
|
||||
|
||||
@ -319,6 +325,7 @@ func GetConfig(v *viper.Viper) (Config, error) {
|
||||
HTTPIdleTimeout: v.GetDuration("json-rpc.http-idle-timeout"),
|
||||
MaxOpenConnections: v.GetInt("json-rpc.max-open-connections"),
|
||||
EnableIndexer: v.GetBool("json-rpc.enable-indexer"),
|
||||
MetricsAddress: v.GetString("json-rpc.metrics-address"),
|
||||
},
|
||||
TLS: TLSConfig{
|
||||
CertificatePath: v.GetString("tls.certificate-path"),
|
||||
|
@ -73,6 +73,10 @@ max-open-connections = {{ .JSONRPC.MaxOpenConnections }}
|
||||
# EnableIndexer enables the custom transaction indexer for the EVM (ethereum transactions).
|
||||
enable-indexer = {{ .JSONRPC.EnableIndexer }}
|
||||
|
||||
# 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 }}"
|
||||
|
||||
###############################################################################
|
||||
### TLS Configuration ###
|
||||
###############################################################################
|
||||
|
@ -49,6 +49,10 @@ const (
|
||||
JSONRPCAllowUnprotectedTxs = "json-rpc.allow-unprotected-txs"
|
||||
JSONRPCMaxOpenConnections = "json-rpc.max-open-connections"
|
||||
JSONRPCEnableIndexer = "json-rpc.enable-indexer"
|
||||
// JSONRPCEnableMetrics enables EVM RPC metrics server.
|
||||
// Set to `metrics` which is hardcoded flag from go-ethereum.
|
||||
// https://github.com/ethereum/go-ethereum/blob/master/metrics/metrics.go#L35-L55
|
||||
JSONRPCEnableMetrics = "metrics"
|
||||
)
|
||||
|
||||
// EVM flags
|
||||
|
@ -33,6 +33,8 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/server/rosetta"
|
||||
crgserver "github.com/cosmos/cosmos-sdk/server/rosetta/lib/server"
|
||||
|
||||
ethmetricsexp "github.com/ethereum/go-ethereum/metrics/exp"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
pruningtypes "github.com/cosmos/cosmos-sdk/pruning/types"
|
||||
@ -171,6 +173,7 @@ which accepts a path for the resulting pprof file.
|
||||
cmd.Flags().Int32(srvflags.JSONRPCBlockRangeCap, config.DefaultBlockRangeCap, "Sets the max block range allowed for `eth_getLogs` query")
|
||||
cmd.Flags().Int(srvflags.JSONRPCMaxOpenConnections, config.DefaultMaxOpenConnections, "Sets the maximum number of simultaneous connections for the server listener") //nolint:lll
|
||||
cmd.Flags().Bool(srvflags.JSONRPCEnableIndexer, false, "Enable the custom tx indexer for json-rpc")
|
||||
cmd.Flags().Bool(srvflags.JSONRPCEnableMetrics, false, "Define if EVM rpc metrics server should be enabled")
|
||||
|
||||
cmd.Flags().String(srvflags.EVMTracer, config.DefaultEVMTracer, "the EVM tracer type to collect execution traces from the EVM transaction execution (json|struct|access_list|markdown)") //nolint:lll
|
||||
cmd.Flags().Uint64(srvflags.EVMMaxTxGasWanted, config.DefaultMaxTxGasWanted, "the gas wanted for each eth tx returned in ante handler in check tx mode") //nolint:lll
|
||||
@ -340,6 +343,12 @@ func startInProcess(ctx *server.Context, clientCtx client.Context, appCreator ty
|
||||
app.RegisterTendermintService(clientCtx)
|
||||
}
|
||||
|
||||
// Enable metrics if JSONRPC is enabled and --metrics is passed
|
||||
// Flag not added in config to avoid user enabling in config without passing in CLI
|
||||
if config.JSONRPC.Enable && ctx.Viper.GetBool(srvflags.JSONRPCEnableMetrics) {
|
||||
ethmetricsexp.Setup(config.JSONRPC.MetricsAddress)
|
||||
}
|
||||
|
||||
var idxer ethermint.EVMTxIndexer
|
||||
if config.JSONRPC.EnableIndexer {
|
||||
idxDB, err := OpenIndexerDB(home, server.GetAppDBBackend(ctx.Viper))
|
||||
|
Loading…
Reference in New Issue
Block a user