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
a005a070
Unverified
Commit
a005a070
authored
Apr 17, 2023
by
Michael de Hoog
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix import cycle
parent
4ffc8e40
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
41 deletions
+39
-41
config.go
op-batcher/batcher/config.go
+2
-37
flags.go
op-batcher/flags/flags.go
+37
-4
No files found.
op-batcher/batcher/config.go
View file @
a005a070
package
batcher
package
batcher
import
(
import
(
"fmt"
"strings"
"strings"
"time"
"time"
...
@@ -145,7 +144,7 @@ func NewConfig(ctx *cli.Context) CLIConfig {
...
@@ -145,7 +144,7 @@ func NewConfig(ctx *cli.Context) CLIConfig {
TargetL1TxSize
:
ctx
.
GlobalUint64
(
flags
.
TargetL1TxSizeBytesFlag
.
Name
),
TargetL1TxSize
:
ctx
.
GlobalUint64
(
flags
.
TargetL1TxSizeBytesFlag
.
Name
),
TargetNumFrames
:
ctx
.
GlobalInt
(
flags
.
TargetNumFramesFlag
.
Name
),
TargetNumFrames
:
ctx
.
GlobalInt
(
flags
.
TargetNumFramesFlag
.
Name
),
ApproxComprRatio
:
ctx
.
GlobalFloat64
(
flags
.
ApproxComprRatioFlag
.
Name
),
ApproxComprRatio
:
ctx
.
GlobalFloat64
(
flags
.
ApproxComprRatioFlag
.
Name
),
CompressorKind
:
CompressorKind
(
strings
.
ToLower
(
ctx
.
GlobalString
(
flags
.
CompressorFlag
.
Name
))),
CompressorKind
:
flags
.
CompressorKind
(
strings
.
ToLower
(
ctx
.
GlobalString
(
flags
.
CompressorFlag
.
Name
))),
Stopped
:
ctx
.
GlobalBool
(
flags
.
StoppedFlag
.
Name
),
Stopped
:
ctx
.
GlobalBool
(
flags
.
StoppedFlag
.
Name
),
TxMgrConfig
:
txmgr
.
ReadCLIConfig
(
ctx
),
TxMgrConfig
:
txmgr
.
ReadCLIConfig
(
ctx
),
RPCConfig
:
rpc
.
ReadCLIConfig
(
ctx
),
RPCConfig
:
rpc
.
ReadCLIConfig
(
ctx
),
...
@@ -157,7 +156,7 @@ func NewConfig(ctx *cli.Context) CLIConfig {
...
@@ -157,7 +156,7 @@ func NewConfig(ctx *cli.Context) CLIConfig {
func
(
c
CLIConfig
)
NewCompressor
()
(
derive
.
Compressor
,
error
)
{
func
(
c
CLIConfig
)
NewCompressor
()
(
derive
.
Compressor
,
error
)
{
switch
c
.
CompressorKind
{
switch
c
.
CompressorKind
{
case
CompressorShadow
:
case
flags
.
CompressorShadow
:
return
NewShadowCompressor
(
return
NewShadowCompressor
(
c
.
MaxL1TxSize
-
1
,
// subtract 1 byte for version
c
.
MaxL1TxSize
-
1
,
// subtract 1 byte for version
)
)
...
@@ -169,37 +168,3 @@ func (c CLIConfig) NewCompressor() (derive.Compressor, error) {
...
@@ -169,37 +168,3 @@ func (c CLIConfig) NewCompressor() (derive.Compressor, error) {
)
)
}
}
}
}
// CompressorKind identifies a compressor implementation.
type
CompressorKind
string
const
(
CompressorTarget
CompressorKind
=
"target"
CompressorShadow
CompressorKind
=
"shadow"
)
var
CompressorKinds
=
[]
CompressorKind
{
CompressorTarget
,
CompressorShadow
,
}
func
(
kind
CompressorKind
)
String
()
string
{
return
string
(
kind
)
}
func
(
kind
*
CompressorKind
)
Set
(
value
string
)
error
{
if
!
ValidCompressorKind
(
CompressorKind
(
value
))
{
return
fmt
.
Errorf
(
"unknown compressor kind: %q"
,
value
)
}
*
kind
=
CompressorKind
(
value
)
return
nil
}
func
ValidCompressorKind
(
value
CompressorKind
)
bool
{
for
_
,
k
:=
range
CompressorKinds
{
if
k
==
value
{
return
true
}
}
return
false
}
op-batcher/flags/flags.go
View file @
a005a070
...
@@ -6,7 +6,6 @@ import (
...
@@ -6,7 +6,6 @@ import (
"github.com/urfave/cli"
"github.com/urfave/cli"
"github.com/ethereum-optimism/optimism/op-batcher/batcher"
"github.com/ethereum-optimism/optimism/op-batcher/rpc"
"github.com/ethereum-optimism/optimism/op-batcher/rpc"
"github.com/ethereum-optimism/optimism/op-node/flags"
"github.com/ethereum-optimism/optimism/op-node/flags"
opservice
"github.com/ethereum-optimism/optimism/op-service"
opservice
"github.com/ethereum-optimism/optimism/op-service"
...
@@ -90,10 +89,10 @@ var (
...
@@ -90,10 +89,10 @@ var (
CompressorFlag
=
cli
.
GenericFlag
{
CompressorFlag
=
cli
.
GenericFlag
{
Name
:
"compressor"
,
Name
:
"compressor"
,
Usage
:
"The type of compressor. Valid options: "
+
Usage
:
"The type of compressor. Valid options: "
+
flags
.
EnumString
[
batcher
.
CompressorKind
](
batcher
.
CompressorKinds
),
flags
.
EnumString
[
CompressorKind
](
CompressorKinds
),
EnvVar
:
opservice
.
PrefixEnvVar
(
envVarPrefix
,
"COMPRESSOR"
),
EnvVar
:
opservice
.
PrefixEnvVar
(
envVarPrefix
,
"COMPRESSOR"
),
Value
:
func
()
*
batcher
.
CompressorKind
{
Value
:
func
()
*
CompressorKind
{
out
:=
batcher
.
CompressorTarget
out
:=
CompressorTarget
return
&
out
return
&
out
}(),
}(),
}
}
...
@@ -148,3 +147,37 @@ func CheckRequired(ctx *cli.Context) error {
...
@@ -148,3 +147,37 @@ func CheckRequired(ctx *cli.Context) error {
}
}
return
nil
return
nil
}
}
// CompressorKind identifies a compressor implementation.
type
CompressorKind
string
const
(
CompressorTarget
CompressorKind
=
"target"
CompressorShadow
CompressorKind
=
"shadow"
)
var
CompressorKinds
=
[]
CompressorKind
{
CompressorTarget
,
CompressorShadow
,
}
func
(
kind
CompressorKind
)
String
()
string
{
return
string
(
kind
)
}
func
(
kind
*
CompressorKind
)
Set
(
value
string
)
error
{
if
!
ValidCompressorKind
(
CompressorKind
(
value
))
{
return
fmt
.
Errorf
(
"unknown compressor kind: %q"
,
value
)
}
*
kind
=
CompressorKind
(
value
)
return
nil
}
func
ValidCompressorKind
(
value
CompressorKind
)
bool
{
for
_
,
k
:=
range
CompressorKinds
{
if
k
==
value
{
return
true
}
}
return
false
}
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