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
aa999b18
Unverified
Commit
aa999b18
authored
Oct 24, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-service: Extract shared method for formatting versions.
parent
d1cd9482
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
109 additions
and
61 deletions
+109
-61
main.go
endpoint-monitor/cmd/main.go
+2
-2
main.go
op-batcher/cmd/main.go
+2
-2
main.go
op-challenger/cmd/main.go
+2
-17
main.go
op-heartbeat/cmd/main.go
+2
-2
main.go
op-node/cmd/main.go
+1
-17
main.go
op-program/host/cmd/main.go
+2
-17
main.go
op-proposer/cmd/main.go
+2
-2
version.go
op-service/version.go
+19
-0
version_test.go
op-service/version_test.go
+75
-0
main.go
op-wheel/cmd/main.go
+2
-2
No files found.
endpoint-monitor/cmd/main.go
View file @
aa999b18
package
main
package
main
import
(
import
(
"fmt"
"os"
"os"
opservice
"github.com/ethereum-optimism/optimism/op-service"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/urfave/cli/v2"
"github.com/urfave/cli/v2"
...
@@ -22,7 +22,7 @@ func main() {
...
@@ -22,7 +22,7 @@ func main() {
app
:=
cli
.
NewApp
()
app
:=
cli
.
NewApp
()
app
.
Flags
=
endpointMonitor
.
CLIFlags
(
"ENDPOINT_MONITOR"
)
app
.
Flags
=
endpointMonitor
.
CLIFlags
(
"ENDPOINT_MONITOR"
)
app
.
Version
=
fmt
.
Sprintf
(
"%s-%s-%s"
,
Version
,
GitCommit
,
GitDate
)
app
.
Version
=
opservice
.
FormatVersion
(
Version
,
GitCommit
,
GitDate
,
""
)
app
.
Name
=
"endpoint-monitor"
app
.
Name
=
"endpoint-monitor"
app
.
Usage
=
"Endpoint Monitoring Service"
app
.
Usage
=
"Endpoint Monitoring Service"
app
.
Description
=
""
app
.
Description
=
""
...
...
op-batcher/cmd/main.go
View file @
aa999b18
package
main
package
main
import
(
import
(
"fmt"
"os"
"os"
opservice
"github.com/ethereum-optimism/optimism/op-service"
"github.com/urfave/cli/v2"
"github.com/urfave/cli/v2"
"github.com/ethereum-optimism/optimism/op-batcher/batcher"
"github.com/ethereum-optimism/optimism/op-batcher/batcher"
...
@@ -26,7 +26,7 @@ func main() {
...
@@ -26,7 +26,7 @@ func main() {
app
:=
cli
.
NewApp
()
app
:=
cli
.
NewApp
()
app
.
Flags
=
cliapp
.
ProtectFlags
(
flags
.
Flags
)
app
.
Flags
=
cliapp
.
ProtectFlags
(
flags
.
Flags
)
app
.
Version
=
fmt
.
Sprintf
(
"%s-%s-%s"
,
Version
,
GitCommit
,
GitDate
)
app
.
Version
=
opservice
.
FormatVersion
(
Version
,
GitCommit
,
GitDate
,
""
)
app
.
Name
=
"op-batcher"
app
.
Name
=
"op-batcher"
app
.
Usage
=
"Batch Submitter Service"
app
.
Usage
=
"Batch Submitter Service"
app
.
Description
=
"Service for generating and submitting L2 tx batches to L1"
app
.
Description
=
"Service for generating and submitting L2 tx batches to L1"
...
...
op-challenger/cmd/main.go
View file @
aa999b18
...
@@ -5,6 +5,7 @@ import (
...
@@ -5,6 +5,7 @@ import (
"os"
"os"
op_challenger
"github.com/ethereum-optimism/optimism/op-challenger"
op_challenger
"github.com/ethereum-optimism/optimism/op-challenger"
opservice
"github.com/ethereum-optimism/optimism/op-service"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/urfave/cli/v2"
"github.com/urfave/cli/v2"
...
@@ -21,23 +22,7 @@ var (
...
@@ -21,23 +22,7 @@ var (
)
)
// VersionWithMeta holds the textual version string including the metadata.
// VersionWithMeta holds the textual version string including the metadata.
var
VersionWithMeta
=
func
()
string
{
var
VersionWithMeta
=
opservice
.
FormatVersion
(
version
.
Version
,
GitCommit
,
GitDate
,
version
.
Meta
)
v
:=
version
.
Version
if
GitCommit
!=
""
{
if
len
(
GitCommit
)
>=
8
{
v
+=
"-"
+
GitCommit
[
:
8
]
}
else
{
v
+=
"-"
+
GitCommit
}
}
if
GitDate
!=
""
{
v
+=
"-"
+
GitDate
}
if
version
.
Meta
!=
""
{
v
+=
"-"
+
version
.
Meta
}
return
v
}()
func
main
()
{
func
main
()
{
args
:=
os
.
Args
args
:=
os
.
Args
...
...
op-heartbeat/cmd/main.go
View file @
aa999b18
package
main
package
main
import
(
import
(
"fmt"
"os"
"os"
heartbeat
"github.com/ethereum-optimism/optimism/op-heartbeat"
heartbeat
"github.com/ethereum-optimism/optimism/op-heartbeat"
"github.com/ethereum-optimism/optimism/op-heartbeat/flags"
"github.com/ethereum-optimism/optimism/op-heartbeat/flags"
opservice
"github.com/ethereum-optimism/optimism/op-service"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/urfave/cli/v2"
"github.com/urfave/cli/v2"
...
@@ -22,7 +22,7 @@ func main() {
...
@@ -22,7 +22,7 @@ func main() {
app
:=
cli
.
NewApp
()
app
:=
cli
.
NewApp
()
app
.
Flags
=
flags
.
Flags
app
.
Flags
=
flags
.
Flags
app
.
Version
=
fmt
.
Sprintf
(
"%s-%s-%s"
,
Version
,
GitCommit
,
GitDate
)
app
.
Version
=
opservice
.
FormatVersion
(
Version
,
GitCommit
,
GitDate
,
""
)
app
.
Name
=
"op-heartbeat"
app
.
Name
=
"op-heartbeat"
app
.
Usage
=
"Heartbeat recorder"
app
.
Usage
=
"Heartbeat recorder"
app
.
Description
=
"Service that records opt-in heartbeats from op nodes"
app
.
Description
=
"Service that records opt-in heartbeats from op nodes"
...
...
op-node/cmd/main.go
View file @
aa999b18
...
@@ -29,23 +29,7 @@ var (
...
@@ -29,23 +29,7 @@ var (
)
)
// VersionWithMeta holds the textual version string including the metadata.
// VersionWithMeta holds the textual version string including the metadata.
var
VersionWithMeta
=
func
()
string
{
var
VersionWithMeta
=
opservice
.
FormatVersion
(
version
.
Version
,
GitCommit
,
GitDate
,
version
.
Meta
)
v
:=
version
.
Version
if
GitCommit
!=
""
{
if
len
(
GitCommit
)
>=
8
{
v
+=
"-"
+
GitCommit
[
:
8
]
}
else
{
v
+=
"-"
+
GitCommit
}
}
if
GitDate
!=
""
{
v
+=
"-"
+
GitDate
}
if
version
.
Meta
!=
""
{
v
+=
"-"
+
version
.
Meta
}
return
v
}()
func
main
()
{
func
main
()
{
// Set up logger with a default INFO level in case we fail to parse flags,
// Set up logger with a default INFO level in case we fail to parse flags,
...
...
op-program/host/cmd/main.go
View file @
aa999b18
...
@@ -7,6 +7,7 @@ import (
...
@@ -7,6 +7,7 @@ import (
"github.com/ethereum-optimism/optimism/op-program/host/config"
"github.com/ethereum-optimism/optimism/op-program/host/config"
"github.com/ethereum-optimism/optimism/op-program/host/flags"
"github.com/ethereum-optimism/optimism/op-program/host/flags"
"github.com/ethereum-optimism/optimism/op-program/host/version"
"github.com/ethereum-optimism/optimism/op-program/host/version"
opservice
"github.com/ethereum-optimism/optimism/op-service"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/urfave/cli/v2"
"github.com/urfave/cli/v2"
...
@@ -18,23 +19,7 @@ var (
...
@@ -18,23 +19,7 @@ var (
)
)
// VersionWithMeta holds the textual version string including the metadata.
// VersionWithMeta holds the textual version string including the metadata.
var
VersionWithMeta
=
func
()
string
{
var
VersionWithMeta
=
opservice
.
FormatVersion
(
version
.
Version
,
GitCommit
,
GitDate
,
version
.
Meta
)
v
:=
version
.
Version
if
GitCommit
!=
""
{
if
len
(
GitCommit
)
>=
8
{
v
+=
"-"
+
GitCommit
[
:
8
]
}
else
{
v
+=
"-"
+
GitCommit
}
}
if
GitDate
!=
""
{
v
+=
"-"
+
GitDate
}
if
version
.
Meta
!=
""
{
v
+=
"-"
+
version
.
Meta
}
return
v
}()
func
main
()
{
func
main
()
{
args
:=
os
.
Args
args
:=
os
.
Args
...
...
op-proposer/cmd/main.go
View file @
aa999b18
package
main
package
main
import
(
import
(
"fmt"
"os"
"os"
opservice
"github.com/ethereum-optimism/optimism/op-service"
"github.com/urfave/cli/v2"
"github.com/urfave/cli/v2"
"github.com/ethereum-optimism/optimism/op-proposer/flags"
"github.com/ethereum-optimism/optimism/op-proposer/flags"
...
@@ -26,7 +26,7 @@ func main() {
...
@@ -26,7 +26,7 @@ func main() {
app
:=
cli
.
NewApp
()
app
:=
cli
.
NewApp
()
app
.
Flags
=
cliapp
.
ProtectFlags
(
flags
.
Flags
)
app
.
Flags
=
cliapp
.
ProtectFlags
(
flags
.
Flags
)
app
.
Version
=
fmt
.
Sprintf
(
"%s-%s-%s"
,
Version
,
GitCommit
,
GitDate
)
app
.
Version
=
opservice
.
FormatVersion
(
Version
,
GitCommit
,
GitDate
,
""
)
app
.
Name
=
"op-proposer"
app
.
Name
=
"op-proposer"
app
.
Usage
=
"L2Output Submitter"
app
.
Usage
=
"L2Output Submitter"
app
.
Description
=
"Service for generating and submitting L2 Output checkpoints to the L2OutputOracle contract"
app
.
Description
=
"Service for generating and submitting L2 Output checkpoints to the L2OutputOracle contract"
...
...
op-service/version.go
0 → 100644
View file @
aa999b18
package
op_service
func
FormatVersion
(
version
string
,
gitCommit
string
,
gitDate
string
,
meta
string
)
string
{
v
:=
version
if
gitCommit
!=
""
{
if
len
(
gitCommit
)
>=
8
{
v
+=
"-"
+
gitCommit
[
:
8
]
}
else
{
v
+=
"-"
+
gitCommit
}
}
if
gitDate
!=
""
{
v
+=
"-"
+
gitDate
}
if
meta
!=
""
{
v
+=
"-"
+
meta
}
return
v
}
op-service/version_test.go
0 → 100644
View file @
aa999b18
package
op_service
import
(
"testing"
"github.com/stretchr/testify/require"
)
func
TestFormatVersion
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
version
string
gitCommit
string
gitDate
string
meta
string
expected
string
}{
{
version
:
"v1.0.0"
,
gitCommit
:
"c90a760cfaccefb60b942ffe4ccf4f9692587cec"
,
gitDate
:
"1698107786"
,
meta
:
""
,
expected
:
"v1.0.0-c90a760c-1698107786"
,
},
{
version
:
"v1.0.0"
,
gitCommit
:
"dev"
,
gitDate
:
"1698107786"
,
meta
:
""
,
expected
:
"v1.0.0-dev-1698107786"
,
},
{
version
:
"v1.0.0"
,
gitCommit
:
""
,
gitDate
:
"1698107786"
,
meta
:
""
,
expected
:
"v1.0.0-1698107786"
,
},
{
version
:
"v1.0.0"
,
gitCommit
:
"dev"
,
gitDate
:
""
,
meta
:
""
,
expected
:
"v1.0.0-dev"
,
},
{
version
:
"v1.0.0"
,
gitCommit
:
""
,
gitDate
:
""
,
meta
:
"rc.1"
,
expected
:
"v1.0.0-rc.1"
,
},
{
version
:
"v1.0.0"
,
gitCommit
:
""
,
gitDate
:
""
,
meta
:
""
,
expected
:
"v1.0.0"
,
},
{
version
:
"v1.0.0"
,
gitCommit
:
"c90a760cfaccefb60b942ffe4ccf4f9692587cec"
,
gitDate
:
"1698107786"
,
meta
:
"beta"
,
expected
:
"v1.0.0-c90a760c-1698107786-beta"
,
},
}
for
_
,
test
:=
range
tests
{
test
:=
test
t
.
Run
(
test
.
expected
,
func
(
t
*
testing
.
T
)
{
actual
:=
FormatVersion
(
test
.
version
,
test
.
gitCommit
,
test
.
gitDate
,
test
.
meta
)
require
.
Equal
(
t
,
test
.
expected
,
actual
)
})
}
}
op-wheel/cmd/main.go
View file @
aa999b18
...
@@ -2,9 +2,9 @@ package main
...
@@ -2,9 +2,9 @@ package main
import
(
import
(
"errors"
"errors"
"fmt"
"os"
"os"
opservice
"github.com/ethereum-optimism/optimism/op-service"
"github.com/urfave/cli/v2"
"github.com/urfave/cli/v2"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
...
@@ -21,7 +21,7 @@ var (
...
@@ -21,7 +21,7 @@ var (
func
main
()
{
func
main
()
{
app
:=
cli
.
NewApp
()
app
:=
cli
.
NewApp
()
app
.
Version
=
fmt
.
Sprintf
(
"%s-%s-%s"
,
Version
,
GitCommit
,
GitDate
)
app
.
Version
=
opservice
.
FormatVersion
(
Version
,
GitCommit
,
GitDate
,
""
)
app
.
Name
=
"op-wheel"
app
.
Name
=
"op-wheel"
app
.
Usage
=
"Optimism Wheel is a CLI tool for the execution engine"
app
.
Usage
=
"Optimism Wheel is a CLI tool for the execution engine"
app
.
Description
=
"Optimism Wheel is a CLI tool to direct the engine one way or the other with DB cheats and Engine API routines."
app
.
Description
=
"Optimism Wheel is a CLI tool to direct the engine one way or the other with DB cheats and Engine API routines."
...
...
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