Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Adopt go.work, rename modules to prep for monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
protolambda committed May 5, 2022
1 parent ec11032 commit b216411
Show file tree
Hide file tree
Showing 126 changed files with 5,705 additions and 300 deletions.
23 changes: 17 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,29 @@ workflows:
branches:
only:
- main
image-name: opnode
image-name: op-node
image-tag: develop
dockerfile: ops/Dockerfile.opnode
name: Build opnode
dockerfile: ops-bedrock/Dockerfile.node
name: Build op-node
- build-dockerfile:
context:
- optimism
filters:
branches:
only:
- main
image-name: l2os
image-name: op-proposer
image-tag: develop
dockerfile: ops/Dockerfile.l2os
name: Build L2 output submitter
dockerfile: ops-bedrock/Dockerfile.proposer
name: Build op-proposer
- build-dockerfile:
context:
- optimism
filters:
branches:
only:
- main
image-name: op-batcher
image-tag: develop
dockerfile: ops-bedrock/Dockerfile.batcher
name: Build op-batcher
61 changes: 52 additions & 9 deletions .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,60 @@ jobs:
go-version: 1.18
- name: Checkout code
uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2

- name: golangci-lint op-node
uses: golangci/golangci-lint-action@v3
with:
version: v1.45.0 # version of golangci-lint, not the action
version: v1.45.2 # version of golangci-lint, not the action
skip-go-installation: true
working-directory: op-node
# rules: https://golangci-lint.run/usage/quick-start/
args: -E asciicheck,goimports,misspell
- name: Test and generate coverage
run: go test -coverpkg=./... -coverprofile=coverage.out -covermode=atomic ./...
- name: golangci-lint op-proposer
uses: golangci/golangci-lint-action@v3
with:
version: v1.45.2 # version of golangci-lint, not the action
skip-go-installation: true
working-directory: op-proposer
args: -E asciicheck,goimports,misspell
- name: golangci-lint op-batcher
uses: golangci/golangci-lint-action@v3
with:
version: v1.45.2 # version of golangci-lint, not the action
skip-go-installation: true
working-directory: op-batcher
args: -E asciicheck,goimports,misspell
- name: golangci-lint op-e2e
uses: golangci/golangci-lint-action@v3
with:
version: v1.45.2 # version of golangci-lint, not the action
skip-go-installation: true
working-directory: op-e2e
args: -E asciicheck,goimports,misspell
- name: Test op-node
run: |
cd op-node
go test -coverpkg=./... -coverprofile=coverage.out -covermode=atomic ./...
- name: Test op-proposer
run: |
cd op-proposer
go test -coverpkg=./... -coverprofile=coverage.out -covermode=atomic ./...
- name: Test op-batcher
run: |
cd op-batcher
go test -coverpkg=./... -coverprofile=coverage.out -covermode=atomic ./...
- name: Test op-e2e
run: |
cd op-e2e
go test -coverpkg=./... -coverprofile=coverage.out -covermode=atomic ./...
- name: Upload coverage output
uses: codecov/codecov-action@v2
with:
files: ./op-node/coverage.out,./op-proposer/coverage.out,./op-batcher/coverage.out,./op-e2e/coverage.out
flags: unittests
name: codecov-umbrella
verbose: true

build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -65,14 +108,14 @@ jobs:
cd packages/contracts
yarn install
- name: opnode Contracts
- name: op-node Contracts
run: |
cd opnode/contracts
cd op-node/contracts
make
git diff --exit-code
- name: l2os Bindings
- name: op-proposer Bindings
run: |
cd l2os
cd op-proposer
make bindings
git diff --exit-code
2 changes: 1 addition & 1 deletion .github/workflows/markdown-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ jobs:
- name: Link Checker
uses: lycheeverse/lychee-action@v1.2.0
with:
args: --verbose --no-progress --exclude-loopback --exclude twitter.com --exclude-mail README.md "./specs/**/*.md" "./meta/**/*.md" "./opnode/**/*.md"
args: --verbose --no-progress --exclude-loopback --exclude twitter.com --exclude-mail README.md "./specs/**/*.md" "./meta/**/*.md" "./op-node/**/*.md"
fail: true
39 changes: 21 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ITESTS_L2_HOST=http://localhost:9545
build: build-go contracts integration-tests
.PHONY: build

build-go: submodules opnode l2os bss
build-go: submodules op-node op-proposer op-batcher
.PHONY: build-go

build-ts: submodules contracts integration-tests
Expand All @@ -18,9 +18,17 @@ submodules:
fi
.PHONY: submodules

opnode:
go build -o ./bin/op ./opnode/cmd
.PHONY: opnode
op-node:
cd ./op-opnode && make op-node
.PHONY: op-node

op-batcher:
cd ./op-batcher && make op-batcher
.PHONY: op-batcher

op-proposer:
cd ./op-proposer && make op-proposer
.PHONY: op-proposer

contracts:
cd ./packages/contracts && yarn install && yarn build
Expand All @@ -35,39 +43,34 @@ clean:
.PHONY: clean

devnet-up:
@bash ./ops/devnet-up.sh
@bash ./ops-bedrock/devnet-up.sh
.PHONY: devnet-up

devnet-down:
@(cd ./ops && GENESIS_TIMESTAMP=$(shell date +%s) docker-compose stop)
@(cd ./ops-bedrock && GENESIS_TIMESTAMP=$(shell date +%s) docker-compose stop)
.PHONY: devnet-down

devnet-clean:
rm -rf ./packages/contracts/deployments/devnetL1
rm -rf ./.devnet
cd ./ops && docker-compose down
cd ./ops-bedrock && docker-compose down
docker volume rm ops_l1_data
docker volume rm ops_l2_data
.PHONY: devnet-clean

test-unit:
cd ./opnode && make test
cd ./op-opnode && make test
cd ./op-proposer && make test
cd ./op-batcher && make test
cd ./op-e2e && make test
cd ./packages/contracts && yarn test
.PHONY: test-unit

test-integration:
bash ./ops/test-integration.sh \
bash ./ops-bedrock/test-integration.sh \
./packages/contracts/deployments/devnetL1
.PHONY: test-integration

devnet-genesis:
bash ./ops/devnet-genesis.sh
bash ./ops-bedrock/devnet-genesis.sh
.PHONY: devnet-genesis

bss:
go build -o ./bin/bss ./bss/cmd/bss
.PHONY: bss

l2os:
go build -o ./bin/l2os ./l2os/cmd/l2os
.PHONY: l2os
13 changes: 13 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
go 1.18

use (
./op-batcher
./op-e2e
./op-node
./op-proposer
)

replace github.com/ethereum/go-ethereum v1.10.16 => github.com/ethereum-optimism/reference-optimistic-geth v0.0.0-20220427171107-d0070e0a6ead

// For local debugging:
// replace github.com/ethereum/go-ethereum v1.10.16 => ../go-ethereum
35 changes: 35 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4=
github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc=
github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4=
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc=
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g=
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0 h1:MSskdM4/xJYcFzy0altH/C/xHopifpWzHUi1JeVI34Q=
github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d h1:t5Wuyh53qYyg9eqn4BbnlIT+vmhyww0TatL+zT3uWgI=
github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ=
github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA=
github.com/ethereum/go-ethereum v1.10.4/go.mod h1:nEE0TP5MtxGzOMd7egIrbPJMQBnhVU3ELNxhBglIzhg=
github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/graph-gophers/graphql-go v0.0.0-20201113091052-beb923fada29/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc=
github.com/huin/goupnp v1.0.1-0.20210310174557-0ca763054c88/go.mod h1:nNs7wvRfN1eKaMknBydLNQU6146XQim8t4h+q90biWo=
github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU=
github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5 h1:2U0HzY8BJ8hVwDKIzp7y4voR9CX/nvcfymLmg2UiOio=
github.com/libp2p/go-yamux v1.4.1 h1:P1Fe9vF4th5JOxxgQvfbOHkrGqIZniTLf+ddhZp8YTI=
github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc=
github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc=
github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/miguelmota/go-ethereum-hdwallet v0.1.1/go.mod h1:f9m9uXokAHA6WNoYOPjj4AqjJS5pquQRiYYj/XSyPYc=
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM=
2 changes: 1 addition & 1 deletion meta/linting.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Justification for linting rules:

```shell
# Install linter globally (should not affect go.mod)
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.0
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.2
# run linter, add --fix option to fix problems (where supported)
golangci-lint run -E asciicheck,goimports,misspell
```
6 changes: 3 additions & 3 deletions meta/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
yarn build
yarn test
cd ../..

# 2.2: Confirm contract bindings are up-to-date
cd opnode/contracts
cd op-node/contracts
make abi
make binding
cd ../..

# 2.3: Run Go tests (including end-to-end tests)
go test -v ../..
```
Expand Down
26 changes: 26 additions & 0 deletions op-batcher/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
GITCOMMIT := $(shell git rev-parse HEAD)
GITDATE := $(shell git show -s --format='%ct')
VERSION := v0.0.0

LDFLAGSSTRING +=-X main.GitCommit=$(GITCOMMIT)
LDFLAGSSTRING +=-X main.GitDate=$(GITDATE)
LDFLAGSSTRING +=-X main.Version=$(VERSION)
LDFLAGS := -ldflags "$(LDFLAGSSTRING)"

op-batcher:
env GO111MODULE=on go build -v $(LDFLAGS) -o ./bin/op-batcher ./cmd/main.go

clean:
rm bin/op-batcher

test:
go test -v ./...

lint:
golangci-lint run -E asciicheck,goimports,misspell ./...

.PHONY: \
op-batcher \
clean \
test \
lint
16 changes: 8 additions & 8 deletions bss/batch_submitter.go → op-batcher/batch_submitter.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bss
package op_batcher

import (
"context"
Expand All @@ -8,11 +8,11 @@ import (
"syscall"
"time"

"github.com/ethereum-optimism/optimistic-specs/bss/db"
"github.com/ethereum-optimism/optimistic-specs/bss/sequencer"
"github.com/ethereum-optimism/optimistic-specs/l2os"
"github.com/ethereum-optimism/optimistic-specs/l2os/rollupclient"
"github.com/ethereum-optimism/optimistic-specs/l2os/txmgr"
"github.com/ethereum-optimism/optimism/op-batcher/db"
"github.com/ethereum-optimism/optimism/op-batcher/sequencer"
proposer "github.com/ethereum-optimism/optimism/op-proposer"
"github.com/ethereum-optimism/optimism/op-proposer/rollupclient"
"github.com/ethereum-optimism/optimism/op-proposer/txmgr"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
Expand Down Expand Up @@ -87,7 +87,7 @@ func Main(version string) func(ctx *cli.Context) error {
// batches to L1 for availability.
type BatchSubmitter struct {
ctx context.Context
sequencerService *l2os.Service
sequencerService *proposer.Service
}

// NewBatchSubmitter initializes the BatchSubmitter, gathering any resources
Expand Down Expand Up @@ -178,7 +178,7 @@ func NewBatchSubmitter(
return nil, err
}

sequencerService := l2os.NewService(l2os.ServiceConfig{
sequencerService := proposer.NewService(proposer.ServiceConfig{
Log: l,
Context: ctx,
Driver: sequencerDriver,
Expand Down
8 changes: 4 additions & 4 deletions bss/cmd/bss/main.go → op-batcher/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/urfave/cli"

"github.com/ethereum-optimism/optimistic-specs/bss"
"github.com/ethereum-optimism/optimistic-specs/bss/flags"
batcher "github.com/ethereum-optimism/optimism/op-batcher"
"github.com/ethereum-optimism/optimism/op-batcher/flags"
)

var (
Expand All @@ -30,12 +30,12 @@ func main() {
app := cli.NewApp()
app.Flags = flags.Flags
app.Version = fmt.Sprintf("%s-%s-%s", Version, GitCommit, GitDate)
app.Name = "bss"
app.Name = "op-batcher"
app.Usage = "Batch Submitter Service"
app.Description = "Service for generating and submitting L2 tx batches " +
"to L1"

app.Action = bss.Main(Version)
app.Action = batcher.Main(Version)
err := app.Run(os.Args)
if err != nil {
log.Crit("Application failed", "message", err)
Expand Down
4 changes: 2 additions & 2 deletions bss/config.go → op-batcher/config.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package bss
package op_batcher

import (
"time"

"github.com/urfave/cli"

"github.com/ethereum-optimism/optimistic-specs/bss/flags"
"github.com/ethereum-optimism/optimism/op-batcher/flags"
)

type Config struct {
Expand Down
2 changes: 1 addition & 1 deletion bss/db/history_db.go → op-batcher/db/history_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"sort"

"github.com/ethereum-optimism/optimistic-specs/opnode/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum/common"
)

Expand Down
Loading

0 comments on commit b216411

Please sign in to comment.