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
e02310c0
Unverified
Commit
e02310c0
authored
Oct 17, 2023
by
protolambda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ops: golang ci improvements
parent
7591f192
Changes
36
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
588 additions
and
396 deletions
+588
-396
config.yml
.circleci/config.yml
+333
-124
Makefile
Makefile
+19
-1
__init__.py
bedrock-devnet/devnet/__init__.py
+3
-1
Makefile
cannon/Makefile
+2
-5
Makefile
endpoint-monitor/Makefile
+2
-2
Dockerfile
op-batcher/Dockerfile
+5
-28
Dockerfile.dockerignore
op-batcher/Dockerfile.dockerignore
+2
-0
Makefile
op-batcher/Makefile
+2
-6
Makefile
op-bindings/Makefile
+0
-3
Makefile
op-bootnode/Makefile
+3
-7
Makefile
op-chain-ops/Makefile
+0
-3
Dockerfile
op-challenger/Dockerfile
+6
-45
Dockerfile.dockerignore
op-challenger/Dockerfile.dockerignore
+2
-0
Makefile
op-challenger/Makefile
+2
-5
Makefile
op-e2e/Makefile
+0
-4
Dockerfile
op-heartbeat/Dockerfile
+4
-17
Dockerfile.dockerignore
op-heartbeat/Dockerfile.dockerignore
+2
-0
Makefile
op-heartbeat/Makefile
+2
-5
Dockerfile
op-node/Dockerfile
+4
-26
Dockerfile.dockerignore
op-node/Dockerfile.dockerignore
+2
-0
Makefile
op-node/Makefile
+2
-5
filepoller_test.go
op-preimage/filepoller_test.go
+6
-6
Dockerfile
op-program/Dockerfile
+4
-28
Dockerfile.dockerignore
op-program/Dockerfile.dockerignore
+2
-0
Makefile
op-program/Makefile
+2
-5
Dockerfile
op-proposer/Dockerfile
+4
-26
Dockerfile.dockerignore
op-proposer/Dockerfile.dockerignore
+2
-0
Makefile
op-proposer/Makefile
+2
-5
Makefile
op-service/Makefile
+0
-3
Dockerfile
op-wheel/Dockerfile
+4
-17
Dockerfile.dockerignore
op-wheel/Dockerfile.dockerignore
+2
-0
Makefile
op-wheel/Makefile
+2
-6
docker-compose.yml
ops-bedrock/docker-compose.yml
+35
-13
Dockerfile
ops/docker/op-stack-go/Dockerfile
+84
-0
Dockerfile.dockerignore
ops/docker/op-stack-go/Dockerfile.dockerignore
+19
-0
geth-version-checker.sh
ops/scripts/geth-version-checker.sh
+23
-0
No files found.
.circleci/config.yml
View file @
e02310c0
This diff is collapsed.
Click to expand it.
Makefile
View file @
e02310c0
COMPOSEFLAGS
=
-d
ITESTS_L2_HOST
=
http://localhost:9545
BEDROCK_TAGS_REMOTE
?=
origin
OP_STACK_GO_BUILDER
?=
us-docker.pkg.dev/oplabs-tools-artifacts/images/op_stack_go:latest
build
:
build-go build-ts
.PHONY
:
build
...
...
@@ -8,6 +9,10 @@ build: build-go build-ts
build-go
:
submodules op-node op-proposer op-batcher
.PHONY
:
build-go
lint-go
:
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
--timeout
5m
-e
"errors.As"
-e
"errors.Is"
./...
.PHONY
:
lint-go
build-ts
:
submodules
if
[
-n
"
$$
NVM_DIR"
]
;
then
\
.
$$
NVM_DIR/nvm.sh
&&
nvm use
;
\
...
...
@@ -19,6 +24,13 @@ build-ts: submodules
ci-builder
:
docker build
-t
ci-builder
-f
ops/docker/ci-builder/Dockerfile .
golang-docker
:
DOCKER_BUILDKIT
=
1 docker build
-t
op-stack-go
\
--build-arg
GIT_COMMIT
=
$$
(
git rev-parse HEAD
)
\
--build-arg
GIT_DATE
=
$$
(
git show
-s
--format
=
'%ct'
)
\
-f
ops/docker/op-stack-go/Dockerfile .
.PHONY
:
golang-docker
submodules
:
# CI will checkout submodules on its own
(
and fails on these commands
)
if
[
-z
"
$$
GITHUB_ENV"
]
;
then
\
...
...
@@ -163,4 +175,10 @@ bedrock-markdown-links:
--exclude-mail
/input/README.md
"/input/specs/**/*.md"
install-geth
:
go
install
github.com/ethereum/go-ethereum/cmd/geth@
$(
shell
cat
.gethrc
)
./ops/scripts/geth-version-checker.sh
&&
\
(
echo
"Geth versions match, not installing geth..."
;
true
)
||
\
(
echo
"Versions do not match, installing geth!"
;
\
go
install
-v
github.com/ethereum/go-ethereum/cmd/geth@
$(
shell
cat
.gethrc
)
;
\
echo
"Installed geth!"
;
true
)
.PHONY
:
install-geth
bedrock-devnet/devnet/__init__.py
View file @
e02310c0
...
...
@@ -96,7 +96,9 @@ def main():
log
.
info
(
'Building docker images'
)
run_command
([
'docker'
,
'compose'
,
'build'
,
'--progress'
,
'plain'
],
cwd
=
paths
.
ops_bedrock_dir
,
env
=
{
'PWD'
:
paths
.
ops_bedrock_dir
'PWD'
:
paths
.
ops_bedrock_dir
,
'DOCKER_BUILDKIT'
:
'1'
,
# (should be available by default in later versions, but explicitly enable it anyway)
'COMPOSE_DOCKER_CLI_BUILD'
:
'1'
# use the docker cache
})
log
.
info
(
'Devnet starting'
)
...
...
cannon/Makefile
View file @
e02310c0
GITCOMMIT
:
=
$(
shell
git rev-parse HEAD
)
GITDATE
:
=
$(
shell
git show
-s
--format
=
'%ct'
)
GITCOMMIT
?
=
$(
shell
git rev-parse HEAD
)
GITDATE
?
=
$(
shell
git show
-s
--format
=
'%ct'
)
VERSION
:=
v0.0.0
LDFLAGSSTRING
+=
-X
main.GitCommit
=
$(GITCOMMIT)
...
...
@@ -20,9 +20,6 @@ elf:
test
:
elf
go
test
-v
./...
lint
:
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
--timeout
5m
-e
"errors.As"
-e
"errors.Is"
fuzz
:
go
test
-run
NOTAREALTEST
-v
-fuzztime
10s
-fuzz
=
FuzzStateSyscallBrk ./mipsevm
go
test
-run
NOTAREALTEST
-v
-fuzztime
10s
-fuzz
=
FuzzStateSyscallClone ./mipsevm
...
...
endpoint-monitor/Makefile
View file @
e02310c0
GITCOMMIT
:
=
$(
shell
git rev-parse HEAD
)
GITDATE
:
=
$(
shell
git show
-s
--format
=
'%ct'
)
GITCOMMIT
?
=
$(
shell
git rev-parse HEAD
)
GITDATE
?
=
$(
shell
git show
-s
--format
=
'%ct'
)
VERSION
:=
v0.0.0
LDFLAGSSTRING
+=
-X
main.GitCommit
=
$(GITCOMMIT)
...
...
op-batcher/Dockerfile
View file @
e02310c0
FROM
--platform=$BUILDPLATFORM golang:1.21.1-alpine3.18 as builder
ARG
VERSION=v0.0.0
RUN
apk add
--no-cache
make gcc musl-dev linux-headers git jq bash
COPY
./go.mod /app/go.mod
COPY
./go.sum /app/go.sum
WORKDIR
/app
RUN
go mod download
# build op-batcher with the shared go.mod & go.sum files
COPY
./op-batcher /app/op-batcher
COPY
./op-bindings /app/op-bindings
COPY
./op-node /app/op-node
COPY
./op-service /app/op-service
COPY
./.git /app/.git
WORKDIR
/app/op-batcher
ARG
TARGETOS TARGETARCH
RUN
make op-batcher
VERSION
=
"
$VERSION
"
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
ARG
OP_STACK_GO_BUILDER=us-docker.pkg.dev/oplabs-tools-artifacts/images/op_stack_go:latest
FROM
$OP_STACK_GO_BUILDER as builder
# See "make golang-docker" and /ops/docker/op-stack-go
FROM
alpine:3.18
COPY
--from=builder /
app/op-batcher/bin/op-batcher /usr/local/bin
COPY
--from=builder /
usr/local/bin/op-batcher /usr/local/bin/op-batcher
ENTRYPOINT
["op-batcher"]
CMD
["op-batcher"]
op-batcher/Dockerfile.dockerignore
0 → 100644
View file @
e02310c0
# ignore everything but the dockerfile, the op-stack-go base image performs the build
*
op-batcher/Makefile
View file @
e02310c0
GITCOMMIT
:
=
$(
shell
git rev-parse HEAD
)
GITDATE
:
=
$(
shell
git show
-s
--format
=
'%ct'
)
GITCOMMIT
?
=
$(
shell
git rev-parse HEAD
)
GITDATE
?
=
$(
shell
git show
-s
--format
=
'%ct'
)
VERSION
:=
v0.0.0
LDFLAGSSTRING
+=
-X
main.GitCommit
=
$(GITCOMMIT)
...
...
@@ -16,9 +16,6 @@ clean:
test
:
go
test
-v
./...
lint
:
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
--timeout
5m
-e
"errors.As"
-e
"errors.Is"
./...
fuzz
:
go
test
-run
NOTAREALTEST
-v
-fuzztime
10s
-fuzz
FuzzChannelConfig_CheckTimeout ./batcher
go
test
-run
NOTAREALTEST
-v
-fuzztime
10s
-fuzz
FuzzDurationZero ./batcher
...
...
@@ -33,5 +30,4 @@ fuzz:
op-batcher
\
clean
\
test
\
lint
\
fuzz
op-bindings/Makefile
View file @
e02310c0
...
...
@@ -26,9 +26,6 @@ bindings-build:
-package
$(pkg)
\
-monorepo-base
$
(
monorepo-base
)
lint
:
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
--timeout
5m
-e
"errors.As"
-e
"errors.Is"
./...
mkdir
:
mkdir
-p
$(pkg)
...
...
op-bootnode/Makefile
View file @
e02310c0
GITCOMMIT
:
=
$(
shell
git rev-parse HEAD
)
GITDATE
:
=
$(
shell
git show
-s
--format
=
'%ct'
)
GITCOMMIT
?
=
$(
shell
git rev-parse HEAD
)
GITDATE
?
=
$(
shell
git show
-s
--format
=
'%ct'
)
VERSION
:=
v0.0.0
LDFLAGSSTRING
+=
-X
main.GitCommit
=
$(GITCOMMIT)
...
...
@@ -16,11 +16,7 @@ clean:
test
:
go
test
-v
./...
lint
:
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
--timeout
5m
-e
"errors.As"
-e
"errors.Is"
./...
.PHONY
:
\
op-bootnode
\
clean
\
test
\
lint
test
op-chain-ops/Makefile
View file @
e02310c0
...
...
@@ -6,9 +6,6 @@ check-l2:
test
:
go
test
./...
lint
:
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
--timeout
5m
-e
"errors.As"
-e
"errors.Is"
./...
fuzz
:
go
test
-run
NOTAREALTEST
-v
-fuzztime
10s
-fuzz
=
FuzzEncodeDecodeWithdrawal ./crossdomain
go
test
-run
NOTAREALTEST
-v
-fuzztime
10s
-fuzz
=
FuzzEncodeDecodeLegacyWithdrawal ./crossdomain
...
...
op-challenger/Dockerfile
View file @
e02310c0
FROM
--platform=$BUILDPLATFORM golang:1.21.1-alpine3.18 as builder
ARG
VERSION=v0.0.0
RUN
apk add
--no-cache
make gcc musl-dev linux-headers git jq bash
COPY
./go.mod /app/go.mod
COPY
./go.sum /app/go.sum
WORKDIR
/app
RUN
go mod download
# build op-challenger with the shared go.mod & go.sum files
COPY
./op-challenger /app/op-challenger
COPY
./op-program /app/op-program
COPY
./op-preimage /app/op-preimage
COPY
./op-bindings /app/op-bindings
COPY
./op-node /app/op-node
COPY
./op-service /app/op-service
COPY
./.git /app/.git
# Copy cannon and its dependencies
COPY
./cannon /app/cannon
COPY
./op-preimage /app/op-preimage
COPY
./op-chain-ops /app/op-chain-ops
WORKDIR
/app/op-program
ARG
TARGETOS TARGETARCH
RUN
make op-program-host
VERSION
=
"
$VERSION
"
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
WORKDIR
/app/cannon
ARG
TARGETOS TARGETARCH
RUN
make cannon
VERSION
=
"
$VERSION
"
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
WORKDIR
/app/op-challenger
RUN
make op-challenger
VERSION
=
"
$VERSION
"
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
ARG
OP_STACK_GO_BUILDER=us-docker.pkg.dev/oplabs-tools-artifacts/images/op_stack_go:latest
FROM
$OP_STACK_GO_BUILDER as builder
# See "make golang-docker" and /ops/docker/op-stack-go
FROM
alpine:3.18
# Make the bundled op-program the default cannon server
COPY
--from=builder /
app/op-program/bin/op-program /usr/local/bin
COPY
--from=builder /
usr/local/bin/op-program /usr/local/bin/op-program
ENV
OP_CHALLENGER_CANNON_SERVER /usr/local/bin/op-program
# Make the bundled cannon the default cannon executable
COPY
--from=builder /
app/cannon/bin/cannon /usr/local/bi
n
COPY
--from=builder /
usr/local/bin/cannon /usr/local/bin/canno
n
ENV
OP_CHALLENGER_CANNON_BIN /usr/local/bin/cannon
COPY
--from=builder /
app/op-challenger/bin/op-challenger /usr/local/bin
COPY
--from=builder /
usr/local/bin/op-challenger /usr/local/bin/op-challenger
CMD
["op-challenger"]
op-challenger/Dockerfile.dockerignore
0 → 100644
View file @
e02310c0
# ignore everything but the dockerfile, the op-stack-go base image performs the build
*
op-challenger/Makefile
View file @
e02310c0
GITCOMMIT
:
=
$(
shell
git rev-parse HEAD
)
GITDATE
:
=
$(
shell
git show
-s
--format
=
'%ct'
)
GITCOMMIT
?
=
$(
shell
git rev-parse HEAD
)
GITDATE
?
=
$(
shell
git show
-s
--format
=
'%ct'
)
VERSION
:=
v0.0.0
LDFLAGSSTRING
+=
-X
main.GitCommit
=
$(GITCOMMIT)
...
...
@@ -16,9 +16,6 @@ clean:
test
:
go
test
-v
./...
lint
:
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
--timeout
5m
-e
"errors.As"
-e
"errors.Is"
./...
visualize
:
./scripts/visualize.sh
...
...
op-e2e/Makefile
View file @
e02310c0
...
...
@@ -51,7 +51,3 @@ clean:
rm
-r
../.devnet
rm
-r
../op-program/bin
.PHONY
:
clean
lint
:
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
--timeout
5m
-e
"errors.As"
-e
"errors.Is"
./...
.PHONY
:
lint
op-heartbeat/Dockerfile
View file @
e02310c0
FROM
golang:1.21.1-alpine3.18 as builder
RUN
apk add
--no-cache
make gcc musl-dev linux-headers git jq bash
# build op-heartbeat with local monorepo go modules
COPY
./op-heartbeat /app/op-heartbeat
COPY
./op-node /app/op-node
COPY
./op-service /app/op-service
COPY
./go.mod /app/go.mod
COPY
./go.sum /app/go.sum
COPY
./.git /app/.git
WORKDIR
/app/op-heartbeat
RUN
make op-heartbeat
ARG
OP_STACK_GO_BUILDER=us-docker.pkg.dev/oplabs-tools-artifacts/images/op_stack_go:latest
FROM
$OP_STACK_GO_BUILDER as builder
# See "make golang-docker" and /ops/docker/op-stack-go
FROM
alpine:3.18
COPY
--from=builder /
app/op-heartbeat/bin/op-heartbeat /usr/local/bin
COPY
--from=builder /
usr/local/bin/op-heartbeat /usr/local/bin/op-heartbeat
CMD
["op-heartbeat"]
op-heartbeat/Dockerfile.dockerignore
0 → 100644
View file @
e02310c0
# ignore everything but the dockerfile, the op-stack-go base image performs the build
*
op-heartbeat/Makefile
View file @
e02310c0
GITCOMMIT
:
=
$(
shell
git rev-parse HEAD
)
GITDATE
:
=
$(
shell
git show
-s
--format
=
'%ct'
)
GITCOMMIT
?
=
$(
shell
git rev-parse HEAD
)
GITDATE
?
=
$(
shell
git show
-s
--format
=
'%ct'
)
VERSION
:=
v0.0.0
LDFLAGSSTRING
+=
-X
main.GitCommit
=
$(GITCOMMIT)
...
...
@@ -16,9 +16,6 @@ clean:
test
:
go
test
-v
./...
lint
:
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
--timeout
5m
-e
"errors.As"
-e
"errors.Is"
./...
.PHONY
:
\
clean
\
op-heartbeat
\
...
...
op-node/Dockerfile
View file @
e02310c0
FROM
--platform=$BUILDPLATFORM golang:1.21.1-alpine3.18 as builder
ARG
VERSION=v0.0.0
RUN
apk add
--no-cache
make gcc musl-dev linux-headers git jq bash
COPY
./go.mod /app/go.mod
COPY
./go.sum /app/go.sum
WORKDIR
/app
RUN
go mod download
# build op-node with the shared go.mod & go.sum files
COPY
./op-node /app/op-node
COPY
./op-chain-ops /app/op-chain-ops
COPY
./op-service /app/op-service
COPY
./op-bindings /app/op-bindings
COPY
./.git /app/.git
WORKDIR
/app/op-node
ARG
TARGETOS TARGETARCH
RUN
make op-node
VERSION
=
"
$VERSION
"
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
ARG
OP_STACK_GO_BUILDER=us-docker.pkg.dev/oplabs-tools-artifacts/images/op_stack_go:latest
FROM
$OP_STACK_GO_BUILDER as builder
# See "make golang-docker" and /ops/docker/op-stack-go
FROM
alpine:3.18
COPY
--from=builder /
app/op-node/bin/op-node /usr/local/bin
COPY
--from=builder /
usr/local/bin/op-node /usr/local/bin/op-node
CMD
["op-node"]
op-node/Dockerfile.dockerignore
0 → 100644
View file @
e02310c0
# ignore everything but the dockerfile, the op-stack-go base image performs the build
*
op-node/Makefile
View file @
e02310c0
GITCOMMIT
:
=
$(
shell
git rev-parse HEAD
)
GITDATE
:
=
$(
shell
git show
-s
--format
=
'%ct'
)
GITCOMMIT
?
=
$(
shell
git rev-parse HEAD
)
GITDATE
?
=
$(
shell
git show
-s
--format
=
'%ct'
)
VERSION
:=
v0.0.0
LDFLAGSSTRING
+=
-X
main.GitCommit
=
$(GITCOMMIT)
...
...
@@ -17,9 +17,6 @@ clean:
test
:
go
test
-v
./...
lint
:
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
--timeout
5m
-e
"errors.As"
-e
"errors.Is"
./...
fuzz
:
go
test
-run
NOTAREALTEST
-v
-fuzztime
10s
-fuzz
FuzzL1InfoRoundTrip ./rollup/derive
go
test
-run
NOTAREALTEST
-v
-fuzztime
10s
-fuzz
FuzzL1InfoAgainstContract ./rollup/derive
...
...
op-preimage/filepoller_test.go
View file @
e02310c0
...
...
@@ -15,9 +15,9 @@ func TestFilePoller_Read(t *testing.T) {
chanAPoller
:=
NewFilePoller
(
ctx
,
chanA
,
time
.
Millisecond
*
100
)
go
func
()
{
chanB
.
Write
([]
byte
(
"hello"
))
_
,
_
=
chanB
.
Write
([]
byte
(
"hello"
))
time
.
Sleep
(
time
.
Second
*
1
)
chanB
.
Write
([]
byte
(
"world"
))
_
,
_
=
chanB
.
Write
([]
byte
(
"world"
))
}()
var
buf
[
10
]
byte
n
,
err
:=
chanAPoller
.
Read
(
buf
[
:
])
...
...
@@ -34,9 +34,9 @@ func TestFilePoller_Write(t *testing.T) {
bufch
:=
make
(
chan
[]
byte
,
1
)
go
func
()
{
var
buf
[
10
]
byte
chanB
.
Read
(
buf
[
:
5
])
_
,
_
=
chanB
.
Read
(
buf
[
:
5
])
time
.
Sleep
(
time
.
Second
*
1
)
chanB
.
Read
(
buf
[
5
:
])
_
,
_
=
chanB
.
Read
(
buf
[
5
:
])
bufch
<-
buf
[
:
]
close
(
bufch
)
}()
...
...
@@ -59,7 +59,7 @@ func TestFilePoller_ReadCancel(t *testing.T) {
chanAPoller
:=
NewFilePoller
(
ctx
,
chanA
,
time
.
Millisecond
*
100
)
go
func
()
{
chanB
.
Write
([]
byte
(
"hello"
))
_
,
_
=
chanB
.
Write
([]
byte
(
"hello"
))
cancel
()
}()
var
buf
[
10
]
byte
...
...
@@ -76,7 +76,7 @@ func TestFilePoller_WriteCancel(t *testing.T) {
go
func
()
{
var
buf
[
5
]
byte
chanB
.
Read
(
buf
[
:
])
_
,
_
=
chanB
.
Read
(
buf
[
:
])
cancel
()
}()
// use a large buffer to overflow the kernel buffer provided to pipe(2) so the write actually blocks
...
...
op-program/Dockerfile
View file @
e02310c0
FROM
--platform=$BUILDPLATFORM golang:1.21.1-alpine3.18 as builder
ARG
VERSION=v0.0.0
RUN
apk add
--no-cache
make gcc musl-dev linux-headers git jq bash
COPY
./go.mod /app/go.mod
COPY
./go.sum /app/go.sum
WORKDIR
/app
RUN
go mod download
# build op-program with the shared go.mod & go.sum files
COPY
./op-program /app/op-program
COPY
./op-preimage /app/op-preimage
COPY
./op-node /app/op-node
COPY
./op-chain-ops /app/op-chain-ops
COPY
./op-service /app/op-service
COPY
./op-bindings /app/op-bindings
COPY
./.git /app/.git
WORKDIR
/app/op-program
ARG
TARGETOS TARGETARCH
RUN
make op-program
VERSION
=
"
$VERSION
"
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
ARG
OP_STACK_GO_BUILDER=us-docker.pkg.dev/oplabs-tools-artifacts/images/op_stack_go:latest
FROM
$OP_STACK_GO_BUILDER as builder
# See "make golang-docker" and /ops/docker/op-stack-go
FROM
alpine:3.18
COPY
--from=builder /
app/op-program/bin/op-program /usr/local/bin
COPY
--from=builder /
usr/local/bin/op-program /usr/local/bin/op-program
CMD
["op-program"]
op-program/Dockerfile.dockerignore
0 → 100644
View file @
e02310c0
# ignore everything but the dockerfile, the op-stack-go base image performs the build
*
op-program/Makefile
View file @
e02310c0
GITCOMMIT
:
=
$(
shell
git rev-parse HEAD
)
GITDATE
:
=
$(
shell
git show
-s
--format
=
'%ct'
)
GITCOMMIT
?
=
$(
shell
git rev-parse HEAD
)
GITDATE
?
=
$(
shell
git show
-s
--format
=
'%ct'
)
VERSION
:=
v0.0.0
LDFLAGSSTRING
+=
-X
main.GitCommit
=
$(GITCOMMIT)
...
...
@@ -30,9 +30,6 @@ clean:
test
:
go
test
-v
./...
lint
:
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
--timeout
5m
-e
"errors.As"
-e
"errors.Is"
./...
verify-goerli
:
op-program-host op-program-client
env
GO111MODULE
=
on go run ./verify/cmd/goerli.go
$$
L1URL
$$
L2URL
...
...
op-proposer/Dockerfile
View file @
e02310c0
FROM
--platform=$BUILDPLATFORM golang:1.21.1-alpine3.18 as builder
ARG
VERSION=v0.0.0
RUN
apk add
--no-cache
make gcc musl-dev linux-headers git jq bash
COPY
./go.mod /app/go.mod
COPY
./go.sum /app/go.sum
WORKDIR
/app
RUN
go mod download
# build op-proposer with the shared go.mod & go.sum files
COPY
./op-proposer /app/op-proposer
COPY
./op-bindings /app/op-bindings
COPY
./op-node /app/op-node
COPY
./op-service /app/op-service
COPY
./.git /app/.git
WORKDIR
/app/op-proposer
ARG
TARGETOS TARGETARCH
RUN
make op-proposer
VERSION
=
"
$VERSION
"
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
ARG
OP_STACK_GO_BUILDER=us-docker.pkg.dev/oplabs-tools-artifacts/images/op_stack_go:latest
FROM
$OP_STACK_GO_BUILDER as builder
# See "make golang-docker" and /ops/docker/op-stack-go
FROM
alpine:3.18
COPY
--from=builder /
app/op-proposer/bin/op-proposer /usr/local/bin
COPY
--from=builder /
usr/local/bin/op-proposer /usr/local/bin/op-proposer
CMD
["op-proposer"]
op-proposer/Dockerfile.dockerignore
0 → 100644
View file @
e02310c0
# ignore everything but the dockerfile, the op-stack-go base image performs the build
*
op-proposer/Makefile
View file @
e02310c0
GITCOMMIT
:
=
$(
shell
git rev-parse HEAD
)
GITDATE
:
=
$(
shell
git show
-s
--format
=
'%ct'
)
GITCOMMIT
?
=
$(
shell
git rev-parse HEAD
)
GITDATE
?
=
$(
shell
git show
-s
--format
=
'%ct'
)
VERSION
:=
v0.0.0
LDFLAGSSTRING
+=
-X
main.GitCommit
=
$(GITCOMMIT)
...
...
@@ -16,9 +16,6 @@ clean:
test
:
go
test
-v
./...
lint
:
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
--timeout
5m
-e
"errors.As"
-e
"errors.Is"
./...
.PHONY
:
\
clean
\
op-proposer
\
...
...
op-service/Makefile
View file @
e02310c0
test
:
go
test
-v
./...
lint
:
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
--timeout
5m
-e
"errors.As"
-e
"errors.Is"
./...
generate-mocks
:
go generate ./...
...
...
op-wheel/Dockerfile
View file @
e02310c0
FROM
golang:1.21.1-alpine3.18 as builder
RUN
apk add
--no-cache
make gcc musl-dev linux-headers
COPY
./op-wheel /app/op-wheel
COPY
./op-node /app/op-node
COPY
./op-chain-ops /app/op-chain-ops
COPY
./op-service /app/op-service
COPY
./op-bindings /app/op-bindings
COPY
./go.mod /app/go.mod
COPY
./go.sum /app/go.sum
WORKDIR
/app/op-wheel
RUN
go build
-o
op-wheel ./cmd/main.go
ARG
OP_STACK_GO_BUILDER=us-docker.pkg.dev/oplabs-tools-artifacts/images/op_stack_go:latest
FROM
$OP_STACK_GO_BUILDER as builder
# See "make golang-docker" and /ops/docker/op-stack-go
FROM
alpine:3.18
COPY
--from=builder /app/op-wheel/op-wheel /usr/local/bin
COPY
--from=builder /app/op-wheel/
bin/
op-wheel /usr/local/bin
CMD
["op-wheel"]
op-wheel/Dockerfile.dockerignore
0 → 100644
View file @
e02310c0
# ignore everything but the dockerfile, the op-stack-go base image performs the build
*
op-wheel/Makefile
View file @
e02310c0
GITCOMMIT
:=
$(
shell
git rev-parse HEAD
)
GITDATE
:=
$(
shell
git show
-s
--format
=
'%ct'
)
GITCOMMIT
?=
$(
shell
git rev-parse HEAD
)
GITDATE
?=
$(
shell
git show
-s
--format
=
'%ct'
)
VERSION
:=
v0.0.0
LDFLAGSSTRING
+=
-X
main.GitCommit
=
$(GITCOMMIT)
...
...
@@ -10,6 +9,3 @@ LDFLAGS := -ldflags "$(LDFLAGSSTRING)"
op-wheel
:
env
GO111MODULE
=
on
GOOS
=
$(TARGETOS)
GOARCH
=
$(TARGETARCH)
go build
-v
$(LDFLAGS)
-o
./bin/op-wheel ./cmd
lint
:
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
--timeout
5m
-e
"errors.As"
-e
"errors.Is"
./...
ops-bedrock/docker-compose.yml
View file @
e02310c0
...
...
@@ -11,6 +11,16 @@ volumes:
services
:
op_stack_go_builder
:
# Not an actual service, but builds the prerequisite go images
build
:
context
:
../
dockerfile
:
ops/docker/op-stack-go/Dockerfile
args
:
GIT_COMMIT
:
"
dev"
GIT_DATE
:
"
0"
image
:
us-docker.pkg.dev/oplabs-tools-artifacts/images/op_stack_go:devnet
entrypoint
:
[
"
echo"
,
"
build
complete"
]
l1
:
build
:
context
:
.
...
...
@@ -42,11 +52,15 @@ services:
op-node
:
depends_on
:
-
op_stack_go_builder
-
l1
-
l2
build
:
context
:
../
dockerfile
:
./op-node/Dockerfile
args
:
OP_STACK_GO_BUILDER
:
us-docker.pkg.dev/oplabs-tools-artifacts/images/op_stack_go:devnet
image
:
us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:devnet
command
:
>
op-node
--l1=ws://l1:8546
...
...
@@ -85,12 +99,16 @@ services:
op-proposer
:
depends_on
:
-
op_stack_go_builder
-
l1
-
l2
-
op-node
build
:
context
:
../
dockerfile
:
./op-proposer/Dockerfile
args
:
OP_STACK_GO_BUILDER
:
us-docker.pkg.dev/oplabs-tools-artifacts/images/op_stack_go:devnet
image
:
us-docker.pkg.dev/oplabs-tools-artifacts/images/op-proposer:devnet
ports
:
-
"
6062:6060"
-
"
7302:7300"
...
...
@@ -110,12 +128,16 @@ services:
op-batcher
:
depends_on
:
-
op_stack_go_builder
-
l1
-
l2
-
op-node
build
:
context
:
../
dockerfile
:
./op-batcher/Dockerfile
args
:
OP_STACK_GO_BUILDER
:
us-docker.pkg.dev/oplabs-tools-artifacts/images/op_stack_go:devnet
image
:
us-docker.pkg.dev/oplabs-tools-artifacts/images/op-batcher:devnet
ports
:
-
"
6061:6060"
-
"
7301:7300"
...
...
@@ -145,16 +167,16 @@ services:
security_opt
:
-
"
no-new-privileges:true"
stateviz
:
build
:
context
:
../
dockerfile
:
./ops-bedrock/Dockerfile.stateviz
command
:
-
stateviz
-
-addr=0.0.0.0:8080
-
-snapshot=/op_log/snapshot.log
-
-refresh=10s
ports
:
-
"
9090:8080"
volumes
:
-
op_log:/op_log:ro
#
stateviz:
#
build:
#
context: ../
#
dockerfile: ./ops-bedrock/Dockerfile.stateviz
#
command:
#
- stateviz
#
- -addr=0.0.0.0:8080
#
- -snapshot=/op_log/snapshot.log
#
- -refresh=10s
#
ports:
#
- "9090:8080"
#
volumes:
#
- op_log:/op_log:ro
ops/docker/op-stack-go/Dockerfile
0 → 100644
View file @
e02310c0
FROM
--platform=$BUILDPLATFORM golang:1.21.3-alpine3.18 as builder
RUN
apk add
--no-cache
make gcc musl-dev linux-headers git jq bash
# We copy the go.mod/sum first, so the `go mod download` does not have to re-run if dependencies do not change.
COPY
./go.mod /app/go.mod
COPY
./go.sum /app/go.sum
WORKDIR
/app
RUN
echo
"go mod cache:
$(
go
env
GOMODCACHE
)
"
RUN
echo
"go build cache:
$(
go
env
GOCACHE
)
"
RUN
--mount
=
type
=
cache,target
=
/go/pkg/mod
--mount
=
type
=
cache,target
=
/root/.cache/go-build go mod download
# NOTE: the Dockerfile.dockerignore file effectively describes all dependencies
COPY
. /app
# We avoid copying the full .git dir into the build for just some metadata.
# Instead, specify:
# --build-arg GIT_COMMIT=$(git rev-parse HEAD)
# --build-arg GIT_DATE=$(git show -s --format='%ct')
ARG
GIT_COMMIT
ARG
GIT_DATE
ARG
CANNON_VERSION=v0.0.0
ARG
OP_PROGRAM_VERSION=v0.0.0
ARG
OP_HEARTBEAT_VERSION=v0.0.0
ARG
OP_WHEEL_VERSION=v0.0.0
ARG
OP_NODE_VERSION=v0.0.0
ARG
OP_CHALLENGER_VERSION=v0.0.0
ARG
OP_BATCHER_VERSION=v0.0.0
ARG
OP_PROPOSER_VERSION=v0.0.0
# separate docker-builds:
# - op-exporter
# - op-ufm
# - proxyd
# - any JS/TS/smart-contract builds
ARG
TARGETOS TARGETARCH
# Build the Go services, utilizing caches and share the many common packages.
# The "id" defaults to the value of "target", the cache will thus be reused during this build.
# "sharing" defaults to "shared", the cache will thus be available to other concurrent docker builds.
RUN
--mount
=
type
=
cache,target
=
/root/.cache/go-build
cd
cannon
&&
make cannon
\
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
GITCOMMIT
=
$GIT_COMMIT
GITDATE
=
$GIT_DATE
VERSION
=
"
$CANNON_VERSION
"
# note: we only build the host, that's all the user needs. No Go MIPS cross-build in docker
RUN
--mount
=
type
=
cache,target
=
/root/.cache/go-build
cd
op-program
&&
make op-program-host
\
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
GITCOMMIT
=
$GIT_COMMIT
GITDATE
=
$GIT_DATE
VERSION
=
"
$OP_PROGRAM_VERSION
"
RUN
--mount
=
type
=
cache,target
=
/root/.cache/go-build
cd
op-heartbeat
&&
make op-heartbeat
\
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
GITCOMMIT
=
$GIT_COMMIT
GITDATE
=
$GIT_DATE
VERSION
=
"
$OP_HEARTBEAT_VERSION
"
RUN
--mount
=
type
=
cache,target
=
/root/.cache/go-build
cd
op-wheel
&&
make op-wheel
\
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
GITCOMMIT
=
$GIT_COMMIT
GITDATE
=
$GIT_DATE
VERSION
=
"
$OP_WHEEL_VERSION
"
RUN
--mount
=
type
=
cache,target
=
/root/.cache/go-build
cd
op-node
&&
make op-node
\
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
GITCOMMIT
=
$GIT_COMMIT
GITDATE
=
$GIT_DATE
VERSION
=
"
$OP_NODE_VERSION
"
RUN
--mount
=
type
=
cache,target
=
/root/.cache/go-build
cd
op-challenger
&&
make op-challenger
\
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
GITCOMMIT
=
$GIT_COMMIT
GITDATE
=
$GIT_DATE
VERSION
=
"
$OP_CHALLENGER_VERSION
"
RUN
--mount
=
type
=
cache,target
=
/root/.cache/go-build
cd
op-batcher
&&
make op-batcher
\
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
GITCOMMIT
=
$GIT_COMMIT
GITDATE
=
$GIT_DATE
VERSION
=
"
$OP_BATCHER_VERSION
"
RUN
--mount
=
type
=
cache,target
=
/root/.cache/go-build
cd
op-proposer
&&
make op-proposer
\
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
GITCOMMIT
=
$GIT_COMMIT
GITDATE
=
$GIT_DATE
VERSION
=
"
$OP_PROPOSER_VERSION
"
FROM
alpine:3.18
COPY
--from=builder /app/cannon/bin/cannon /usr/local/bin/
COPY
--from=builder /app/op-program/bin/op-program /usr/local/bin/
COPY
--from=builder /app/op-heartbeat/bin/op-heartbeat /usr/local/bin/
COPY
--from=builder /app/op-wheel/bin/op-wheel /usr/local/bin/
COPY
--from=builder /app/op-node/bin/op-node /usr/local/bin/
COPY
--from=builder /app/op-challenger/bin/op-challenger /usr/local/bin/
COPY
--from=builder /app/op-batcher/bin/op-batcher /usr/local/bin/
COPY
--from=builder /app/op-proposer/bin/op-proposer /usr/local/bin/
ops/docker/op-stack-go/Dockerfile.dockerignore
0 → 100644
View file @
e02310c0
# All the files we depend on. We are using a negative pattern to not include anything by accident.
# node_modules, packages (contains git submodules and node modules etc.), devnet dirs etc. all add up a lot.
*
!/cannon
!/op-batcher
!/op-bindings
!/op-bootnode
!/op-chain-ops
!/op-challenger
!/op-heartbeat
!/op-node
!/op-preimage
!/op-program
!/op-proposer
!/op-service
!/op-wheel
!/go.mod
!/go.sum
ops/scripts/geth-version-checker.sh
0 → 100755
View file @
e02310c0
#!/bin/bash
# Extract the version from the geth command output
GETH_VERSION
=
"v
$(
geth version |
grep
'^Version:'
|
awk
'{print $2}'
)
"
# Read the version from the .gethrc file
GETHRC_VERSION
=
$(
cat
.gethrc
)
# Check if GETHRC_VERSION contains a '-'. If not, append '-stable'.
if
[[
$GETHRC_VERSION
!=
*
-
*
]]
;
then
GETHRC_VERSION
=
"
${
GETHRC_VERSION
}
-stable"
fi
# Compare the versions
if
[[
"
$GETH_VERSION
"
==
"
$GETHRC_VERSION
"
]]
;
then
echo
"Geth version
$GETH_VERSION
is correct!"
exit
0
else
echo
"Geth version does not match!"
echo
"geth version:
$GETH_VERSION
"
echo
".gethrc version:
$GETHRC_VERSION
"
exit
1
fi
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