Commit cd3f9d51 authored by Joshua Gutow's avatar Joshua Gutow Committed by GitHub

Merge pull request #7661 from ethereum-optimism/jg/admin_api_proposer

op-proposer: Enable default Admin RPC
parents 398a09b4 c444974c
......@@ -37,6 +37,7 @@ type Metrics struct {
opmetrics.RefMetrics
txmetrics.TxMetrics
opmetrics.RPCMetrics
info prometheus.GaugeVec
up prometheus.Gauge
......@@ -60,6 +61,7 @@ func NewMetrics(procName string) *Metrics {
RefMetrics: opmetrics.MakeRefMetrics(ns, factory),
TxMetrics: txmetrics.MakeTxMetrics(ns, factory),
RPCMetrics: opmetrics.MakeRPCMetrics(ns, factory),
info: *factory.NewGaugeVec(prometheus.GaugeOpts{
Namespace: ns,
......
......@@ -106,6 +106,10 @@ func Main(version string, cliCtx *cli.Context) error {
rpcCfg := cfg.RPCConfig
server := oprpc.NewServer(rpcCfg.ListenAddr, rpcCfg.ListenPort, version, oprpc.WithLogger(l))
if rpcCfg.EnableAdmin {
server.AddAPI(oprpc.ToGethAdminAPI(oprpc.NewCommonAdminAPI(&m.RPCMetrics, l)))
l.Info("Admin RPC enabled")
}
if err := server.Start(); err != nil {
return fmt.Errorf("error starting RPC server: %w", err)
}
......
......@@ -7,8 +7,16 @@ import (
oplog "github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum-optimism/optimism/op-service/metrics"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
)
func ToGethAdminAPI(api *CommonAdminAPI) rpc.API {
return rpc.API{
Namespace: "admin",
Service: api,
}
}
type CommonAdminAPI struct {
M metrics.RPCMetricer
log log.Logger
......
......@@ -94,6 +94,7 @@ services:
ports:
- "6062:6060"
- "7302:7300"
- "6546:8545"
environment:
OP_PROPOSER_L1_ETH_RPC: http://l1:8545
OP_PROPOSER_ROLLUP_RPC: http://op-node:8545
......@@ -105,6 +106,7 @@ services:
OP_PROPOSER_PPROF_ENABLED: "true"
OP_PROPOSER_METRICS_ENABLED: "true"
OP_PROPOSER_ALLOW_NON_FINALIZED: "true"
OP_PROPOSER_RPC_ENABLE_ADMIN: "true"
op-batcher:
depends_on:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment