Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
07647f59
Commit
07647f59
authored
Sep 29, 2023
by
Seungju Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: remove op-batcher/rpc CLIFlags and use op-service/rpc CLIFlags instead
parent
9dd1b384
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
52 deletions
+20
-52
batch_submitter.go
op-batcher/batcher/batch_submitter.go
+3
-4
config.go
op-batcher/batcher/config.go
+3
-6
flags.go
op-batcher/flags/flags.go
+0
-2
config.go
op-batcher/rpc/config.go
+0
-34
cli.go
op-service/rpc/cli.go
+14
-6
No files found.
op-batcher/batcher/batch_submitter.go
View file @
07647f59
...
...
@@ -72,14 +72,13 @@ func Main(version string, cliCtx *cli.Context) error {
m
.
StartBalanceMetrics
(
ctx
,
l
,
batchSubmitter
.
L1Client
,
batchSubmitter
.
TxManager
.
From
())
}
rpcCfg
:=
cfg
.
RPCConfig
server
:=
oprpc
.
NewServer
(
rpcCf
g
.
ListenAddr
,
rpcCf
g
.
ListenPort
,
cfg
.
RPCFla
g
.
ListenAddr
,
cfg
.
RPCFla
g
.
ListenPort
,
version
,
oprpc
.
WithLogger
(
l
),
)
if
rpcCf
g
.
EnableAdmin
{
if
cfg
.
RPCFla
g
.
EnableAdmin
{
server
.
AddAPI
(
gethrpc
.
API
{
Namespace
:
"admin"
,
Service
:
rpc
.
NewAdminAPI
(
batchSubmitter
),
...
...
op-batcher/batcher/config.go
View file @
07647f59
...
...
@@ -10,12 +10,12 @@ import (
"github.com/ethereum-optimism/optimism/op-batcher/compressor"
"github.com/ethereum-optimism/optimism/op-batcher/flags"
"github.com/ethereum-optimism/optimism/op-batcher/metrics"
"github.com/ethereum-optimism/optimism/op-batcher/rpc"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/sources"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
opmetrics
"github.com/ethereum-optimism/optimism/op-service/metrics"
oppprof
"github.com/ethereum-optimism/optimism/op-service/pprof"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
)
...
...
@@ -88,17 +88,14 @@ type CLIConfig struct {
Stopped
bool
TxMgrConfig
txmgr
.
CLIConfig
RPCConfig
rpc
.
CLIConfig
LogConfig
oplog
.
CLIConfig
MetricsConfig
opmetrics
.
CLIConfig
PprofConfig
oppprof
.
CLIConfig
CompressorConfig
compressor
.
CLIConfig
RPCFlag
oprpc
.
CLIConfig
}
func
(
c
CLIConfig
)
Check
()
error
{
if
err
:=
c
.
RPCConfig
.
Check
();
err
!=
nil
{
return
err
}
if
err
:=
c
.
MetricsConfig
.
Check
();
err
!=
nil
{
return
err
}
...
...
@@ -127,10 +124,10 @@ func NewConfig(ctx *cli.Context) CLIConfig {
MaxL1TxSize
:
ctx
.
Uint64
(
flags
.
MaxL1TxSizeBytesFlag
.
Name
),
Stopped
:
ctx
.
Bool
(
flags
.
StoppedFlag
.
Name
),
TxMgrConfig
:
txmgr
.
ReadCLIConfig
(
ctx
),
RPCConfig
:
rpc
.
ReadCLIConfig
(
ctx
),
LogConfig
:
oplog
.
ReadCLIConfig
(
ctx
),
MetricsConfig
:
opmetrics
.
ReadCLIConfig
(
ctx
),
PprofConfig
:
oppprof
.
ReadCLIConfig
(
ctx
),
CompressorConfig
:
compressor
.
ReadCLIConfig
(
ctx
),
RPCFlag
:
oprpc
.
ReadCLIConfig
(
ctx
),
}
}
op-batcher/flags/flags.go
View file @
07647f59
...
...
@@ -7,7 +7,6 @@ import (
"github.com/urfave/cli/v2"
"github.com/ethereum-optimism/optimism/op-batcher/compressor"
"github.com/ethereum-optimism/optimism/op-batcher/rpc"
opservice
"github.com/ethereum-optimism/optimism/op-service"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
opmetrics
"github.com/ethereum-optimism/optimism/op-service/metrics"
...
...
@@ -102,7 +101,6 @@ func init() {
optionalFlags
=
append
(
optionalFlags
,
oplog
.
CLIFlags
(
EnvVarPrefix
)
...
)
optionalFlags
=
append
(
optionalFlags
,
opmetrics
.
CLIFlags
(
EnvVarPrefix
)
...
)
optionalFlags
=
append
(
optionalFlags
,
oppprof
.
CLIFlags
(
EnvVarPrefix
)
...
)
optionalFlags
=
append
(
optionalFlags
,
rpc
.
CLIFlags
(
EnvVarPrefix
)
...
)
optionalFlags
=
append
(
optionalFlags
,
txmgr
.
CLIFlags
(
EnvVarPrefix
)
...
)
optionalFlags
=
append
(
optionalFlags
,
compressor
.
CLIFlags
(
EnvVarPrefix
)
...
)
...
...
op-batcher/rpc/config.go
deleted
100644 → 0
View file @
9dd1b384
package
rpc
import
(
"github.com/urfave/cli/v2"
opservice
"github.com/ethereum-optimism/optimism/op-service"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
)
const
(
EnableAdminFlagName
=
"rpc.enable-admin"
)
func
CLIFlags
(
envPrefix
string
)
[]
cli
.
Flag
{
return
[]
cli
.
Flag
{
&
cli
.
BoolFlag
{
Name
:
EnableAdminFlagName
,
Usage
:
"Enable the admin API (experimental)"
,
EnvVars
:
opservice
.
PrefixEnvVar
(
envPrefix
,
"RPC_ENABLE_ADMIN"
),
},
}
}
type
CLIConfig
struct
{
oprpc
.
CLIConfig
EnableAdmin
bool
}
func
ReadCLIConfig
(
ctx
*
cli
.
Context
)
CLIConfig
{
return
CLIConfig
{
CLIConfig
:
oprpc
.
ReadCLIConfig
(
ctx
),
EnableAdmin
:
ctx
.
Bool
(
EnableAdminFlagName
),
}
}
op-service/rpc/cli.go
View file @
07647f59
...
...
@@ -9,8 +9,9 @@ import (
)
const
(
ListenAddrFlagName
=
"rpc.addr"
PortFlagName
=
"rpc.port"
ListenAddrFlagName
=
"rpc.addr"
PortFlagName
=
"rpc.port"
EnableAdminFlagName
=
"rpc.enable-admin"
)
func
CLIFlags
(
envPrefix
string
)
[]
cli
.
Flag
{
...
...
@@ -27,12 +28,18 @@ func CLIFlags(envPrefix string) []cli.Flag {
Value
:
8545
,
EnvVars
:
opservice
.
PrefixEnvVar
(
envPrefix
,
"RPC_PORT"
),
},
&
cli
.
BoolFlag
{
Name
:
EnableAdminFlagName
,
Usage
:
"Enable the admin API (experimental)"
,
EnvVars
:
opservice
.
PrefixEnvVar
(
envPrefix
,
"RPC_ENABLE_ADMIN"
),
},
}
}
type
CLIConfig
struct
{
ListenAddr
string
ListenPort
int
ListenAddr
string
ListenPort
int
EnableAdmin
bool
}
func
(
c
CLIConfig
)
Check
()
error
{
...
...
@@ -45,7 +52,8 @@ func (c CLIConfig) Check() error {
func
ReadCLIConfig
(
ctx
*
cli
.
Context
)
CLIConfig
{
return
CLIConfig
{
ListenAddr
:
ctx
.
String
(
ListenAddrFlagName
),
ListenPort
:
ctx
.
Int
(
PortFlagName
),
ListenAddr
:
ctx
.
String
(
ListenAddrFlagName
),
ListenPort
:
ctx
.
Int
(
PortFlagName
),
EnableAdmin
:
ctx
.
Bool
(
EnableAdminFlagName
),
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment