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
1623353f
Commit
1623353f
authored
May 04, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduces configuration setup to the op-challenger service as similar
as possible to the op-proposer service.
parent
2389d445
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
0 deletions
+92
-0
config.go
op-challenger/challenger/config.go
+92
-0
No files found.
op-challenger/challenger/config.go
0 → 100644
View file @
1623353f
package
challenger
import
(
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/urfave/cli"
flags
"github.com/ethereum-optimism/optimism/op-challenger/flags"
sources
"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"
txmgr
"github.com/ethereum-optimism/optimism/op-service/txmgr"
)
// Config contains the well typed fields that are used to initialize the challenger.
// It is intended for programmatic use.
type
Config
struct
{
L2OutputOracleAddr
common
.
Address
DisputeGameFactory
common
.
Address
NetworkTimeout
time
.
Duration
TxManager
txmgr
.
TxManager
L1Client
*
ethclient
.
Client
RollupClient
*
sources
.
RollupClient
}
// CLIConfig is a well typed config that is parsed from the CLI params.
// This also contains config options for auxiliary services.
// It is transformed into a `Config` before the Challenger is started.
type
CLIConfig
struct
{
// L1EthRpc is the HTTP provider URL for L1.
L1EthRpc
string
// RollupRpc is the HTTP provider URL for the rollup node.
RollupRpc
string
// L2OOAddress is the L2OutputOracle contract address.
L2OOAddress
string
// DGFAddress is the DisputeGameFactory contract address.
DGFAddress
string
TxMgrConfig
txmgr
.
CLIConfig
RPCConfig
oprpc
.
CLIConfig
LogConfig
oplog
.
CLIConfig
MetricsConfig
opmetrics
.
CLIConfig
PprofConfig
oppprof
.
CLIConfig
}
func
(
c
CLIConfig
)
Check
()
error
{
if
err
:=
c
.
RPCConfig
.
Check
();
err
!=
nil
{
return
err
}
if
err
:=
c
.
LogConfig
.
Check
();
err
!=
nil
{
return
err
}
if
err
:=
c
.
MetricsConfig
.
Check
();
err
!=
nil
{
return
err
}
if
err
:=
c
.
PprofConfig
.
Check
();
err
!=
nil
{
return
err
}
if
err
:=
c
.
TxMgrConfig
.
Check
();
err
!=
nil
{
return
err
}
return
nil
}
// NewConfig parses the Config from the provided flags or environment variables.
func
NewConfig
(
ctx
*
cli
.
Context
)
CLIConfig
{
return
CLIConfig
{
// Required Flags
L1EthRpc
:
ctx
.
GlobalString
(
flags
.
L1EthRpcFlag
.
Name
),
RollupRpc
:
ctx
.
GlobalString
(
flags
.
RollupRpcFlag
.
Name
),
L2OOAddress
:
ctx
.
GlobalString
(
flags
.
L2OOAddressFlag
.
Name
),
DGFAddress
:
ctx
.
GlobalString
(
flags
.
DGFAddressFlag
.
Name
),
TxMgrConfig
:
txmgr
.
ReadCLIConfig
(
ctx
),
// Optional Flags
RPCConfig
:
oprpc
.
ReadCLIConfig
(
ctx
),
LogConfig
:
oplog
.
ReadCLIConfig
(
ctx
),
MetricsConfig
:
opmetrics
.
ReadCLIConfig
(
ctx
),
PprofConfig
:
oppprof
.
ReadCLIConfig
(
ctx
),
}
}
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