Commit a655feab authored by Diederik Loerakker's avatar Diederik Loerakker Committed by GitHub

op-bindings: bedrock go bindings (#2571)

parent ad6b5dea
......@@ -385,13 +385,22 @@ jobs:
name: gas snapshot
command: forge snapshot
working_directory: contracts-bedrock
- run:
name: check go bindings
command: |
make && git diff --exit-code
working_directory: op-bindings
bedrock-go-tests:
docker:
- image: ethereumoptimism/go-builder:latest
steps:
- checkout
- run:
name: lint op-bindings
command: |
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell ./...
working_directory: op-bindings
- run:
name: lint op-node
command: |
......
......@@ -41,3 +41,6 @@ packages/integration-tests-bedrock/artifacts
**/testdata/fuzz/
coverage.out
# Ignore bedrock go bindings local output files
op-bindings/bin
......@@ -18,6 +18,10 @@ submodules:
fi
.PHONY: submodules
op-bindings:
make -C ./op-bindings
.PHONY: op-bindings
op-node:
make -C ./op-node op-node
.PHONY: op-node
......
......@@ -58,6 +58,7 @@ root
~~ BEDROCK upgrade - Not production-ready yet, part of next major upgrade ~~
├── <a href="./contracts-bedrock">contracts-bedrock</a>: Bedrock smart contracts. To be merged with ./packages/contracts.
├── <a href="./op-bindings">op-bindings</a>: Go bindings for Bedrock smart contracts.
├── <a href="./op-batcher">op-batcher</a>: L2-Batch Submitter, submits bundles of batches to L1
├── <a href="./op-e2e">op-e2e</a>: End-to-End testing of all bedrock components in Go
├── <a href="./op-node">op-node</a>: rollup consensus-layer client.
......
......@@ -8,6 +8,7 @@ use (
./l2geth
./l2geth-exporter
./op-batcher
./op-bindings
./op-e2e
./op-exporter
./op-node
......@@ -16,8 +17,7 @@ use (
./teleportr
)
replace github.com/ethereum-optimism/optimism/bss-core v0.0.0 => ./bss-core
replace github.com/ethereum/go-ethereum v1.10.17 => github.com/ethereum-optimism/reference-optimistic-geth v0.0.0-20220512193241-32ef0bba48ce
replace github.com/ethereum-optimism/optimism/l2geth v0.0.0 => ./l2geth
replace github.com/ethereum/go-ethereum v1.10.16 => github.com/ethereum-optimism/reference-optimistic-geth v0.0.0-20220512193241-32ef0bba48ce
// For local debugging:
// replace github.com/ethereum/go-ethereum v1.10.17 => ../go-ethereum
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/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
github.com/ethereum-optimism/reference-optimistic-geth v0.0.0-20220512193241-32ef0bba48ce h1:Wa0BVNdeyzIoJkrZtI7o2NEw8F98vVIzkPpiFACbdCA=
github.com/ethereum-optimism/reference-optimistic-geth v0.0.0-20220512193241-32ef0bba48ce/go.mod h1:zwRwhzbX7GhQgG12DdrLr9aRGGLObKwmZxYrCLICIRc=
github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY=
github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8=
github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5 h1:2U0HzY8BJ8hVwDKIzp7y4voR9CX/nvcfymLmg2UiOio=
github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/libp2p/go-yamux v1.4.1 h1:P1Fe9vF4th5JOxxgQvfbOHkrGqIZniTLf+ddhZp8YTI=
github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/tools v0.0.0-20191126055441-b0650ceb63d9/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
......@@ -5,7 +5,7 @@ go 1.18
require (
github.com/ethereum-optimism/optimism/op-node v0.0.0
github.com/ethereum-optimism/optimism/op-proposer v0.0.0
github.com/ethereum/go-ethereum v1.10.16
github.com/ethereum/go-ethereum v1.10.17
github.com/miguelmota/go-ethereum-hdwallet v0.1.1
github.com/stretchr/testify v1.7.0
github.com/urfave/cli v1.22.5
......@@ -29,6 +29,7 @@ require (
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/elastic/gosigar v0.12.0 // indirect
github.com/ethereum-optimism/optimism/op-bindings v0.0.0 // indirect
github.com/fjl/memsize v0.0.1 // indirect
github.com/flynn/noise v1.0.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
......@@ -154,8 +155,9 @@ require (
)
replace (
github.com/ethereum-optimism/optimism/op-bindings v0.0.0 => ../op-bindings
github.com/ethereum-optimism/optimism/op-node v0.0.0 => ../op-node
github.com/ethereum-optimism/optimism/op-proposer v0.0.0 => ../op-proposer
)
replace github.com/ethereum/go-ethereum v1.10.16 => github.com/ethereum-optimism/reference-optimistic-geth v0.0.0-20220427171107-d0070e0a6ead
replace github.com/ethereum/go-ethereum v1.10.17 => github.com/ethereum-optimism/reference-optimistic-geth v0.0.0-20220427171107-d0070e0a6ead
SHELL := /bin/bash
CONTRACTS_PATH := "../../packages/contracts/"
CONTRACTS_PATH := "../contracts-bedrock/"
all: bindings deployed
bindings: bindings-l1-block-info bindings-optimism-portal bindings-L2ToL1MessagePasser
bindings: bindings-l1-block-info bindings-optimism-portal bindings-L2ToL1MessagePasser bindings-l2-output-oracle
deployed: deployed-bin-l1-block-info deployed-bin-optimism-portal deployed-bin-L2ToL1MessagePasser
# Deployed bindings are split because they depend on the bin file
......@@ -83,3 +83,19 @@ bindings-optimism-portal:
--type OptimismPortal \
--out ./deposit/deposit_feed_raw.go
bindings-l2-output-oracle:
$(eval temp := $(shell mktemp -d))
$(eval cwd := $(shell pwd))
cd $(CONTRACTS_PATH); \
forge build \
&& forge inspect L2OutputOracle abi > $(temp)/L2OutputOracle.abi \
&& forge inspect L2OutputOracle bytecode > $(temp)/L2OutputOracle.bin \
&& forge inspect L2OutputOracle deployedBytecode > $(cwd)/bin/l2_output_oracle_deployed.hex
abigen \
--abi $(temp)/L2OutputOracle.abi \
--bin $(temp)/L2OutputOracle.bin \
--pkg l2oo \
--type L2OutputOracle \
--out ./l2oo/l2_output_oracle.go
......@@ -7,4 +7,4 @@ To regenerate the bindings, run `make`
The following programs are required: `jq`, `abigen`, and `solc` (at version 0.8.10)
*/
package contracts
package op_bindings
module github.com/ethereum-optimism/optimism/op-bindings
go 1.18
require github.com/ethereum/go-ethereum v1.10.17
require (
github.com/VictoriaMetrics/fastcache v1.9.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.1.3 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/edsrzf/mmap-go v1.1.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/golang-jwt/jwt/v4 v4.3.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/prometheus/tsdb v0.10.0 // indirect
github.com/rjeczalik/notify v0.9.2 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 // indirect
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
)
replace github.com/ethereum/go-ethereum v1.10.17 => github.com/ethereum-optimism/reference-optimistic-geth v0.0.0-20220512193241-32ef0bba48ce
This diff is collapsed.
......@@ -4,9 +4,10 @@ go 1.18
require (
github.com/ethereum-optimism/optimism/op-batcher v0.0.0
github.com/ethereum-optimism/optimism/op-bindings v0.0.0
github.com/ethereum-optimism/optimism/op-node v0.0.0
github.com/ethereum-optimism/optimism/op-proposer v0.0.0
github.com/ethereum/go-ethereum v1.10.16
github.com/ethereum/go-ethereum v1.10.17
github.com/libp2p/go-libp2p v0.18.1
github.com/libp2p/go-libp2p-core v0.15.0
github.com/miguelmota/go-ethereum-hdwallet v0.1.1
......@@ -161,8 +162,9 @@ require (
replace (
github.com/ethereum-optimism/optimism/op-batcher v0.0.0 => ../op-batcher
github.com/ethereum-optimism/optimism/op-bindings v0.0.0 => ../op-bindings
github.com/ethereum-optimism/optimism/op-node v0.0.0 => ../op-node
github.com/ethereum-optimism/optimism/op-proposer v0.0.0 => ../op-proposer
)
replace github.com/ethereum/go-ethereum v1.10.16 => github.com/ethereum-optimism/reference-optimistic-geth v0.0.0-20220512193241-32ef0bba48ce
replace github.com/ethereum/go-ethereum v1.10.17 => github.com/ethereum-optimism/reference-optimistic-geth v0.0.0-20220512193241-32ef0bba48ce
......@@ -10,15 +10,15 @@ import (
"time"
bss "github.com/ethereum-optimism/optimism/op-batcher"
"github.com/ethereum-optimism/optimism/op-node/contracts/deposit"
"github.com/ethereum-optimism/optimism/op-node/contracts/l1block"
"github.com/ethereum-optimism/optimism/op-node/contracts/withdrawer"
"github.com/ethereum-optimism/optimism/op-bindings/deposit"
"github.com/ethereum-optimism/optimism/op-bindings/l1block"
"github.com/ethereum-optimism/optimism/op-bindings/l2oo"
"github.com/ethereum-optimism/optimism/op-bindings/withdrawer"
rollupNode "github.com/ethereum-optimism/optimism/op-node/node"
"github.com/ethereum-optimism/optimism/op-node/p2p"
"github.com/ethereum-optimism/optimism/op-node/predeploy"
"github.com/ethereum-optimism/optimism/op-node/rollup"
l2os "github.com/ethereum-optimism/optimism/op-proposer"
"github.com/ethereum-optimism/optimism/op-proposer/bindings/l2oo"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
......
......@@ -8,9 +8,10 @@ import (
"testing"
"time"
"github.com/ethereum-optimism/optimism/op-node/contracts/deposit"
"github.com/ethereum-optimism/optimism/op-node/contracts/l1block"
"github.com/ethereum-optimism/optimism/op-node/contracts/withdrawer"
"github.com/ethereum-optimism/optimism/op-bindings/deposit"
"github.com/ethereum-optimism/optimism/op-bindings/l1block"
"github.com/ethereum-optimism/optimism/op-bindings/l2oo"
"github.com/ethereum-optimism/optimism/op-bindings/withdrawer"
"github.com/ethereum-optimism/optimism/op-node/l2"
"github.com/ethereum-optimism/optimism/op-node/node"
rollupNode "github.com/ethereum-optimism/optimism/op-node/node"
......@@ -19,7 +20,6 @@ import (
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/withdrawals"
"github.com/ethereum-optimism/optimism/op-proposer/bindings/l2oo"
"github.com/ethereum-optimism/optimism/op-proposer/rollupclient"
"github.com/ethereum/go-ethereum"
......
......@@ -3,8 +3,8 @@ module github.com/ethereum-optimism/optimism/op-node
go 1.18
require (
github.com/ethereum-optimism/optimism/op-proposer v0.0.0
github.com/ethereum/go-ethereum v1.10.16
github.com/ethereum-optimism/optimism/op-bindings v0.0.0
github.com/ethereum/go-ethereum v1.10.17
github.com/golang/snappy v0.0.4
github.com/google/go-cmp v0.5.8
github.com/hashicorp/go-multierror v1.0.0
......@@ -171,9 +171,11 @@ require (
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
replace github.com/ethereum/go-ethereum v1.10.16 => github.com/ethereum-optimism/reference-optimistic-geth v0.0.0-20220428214415-643b449b5818
replace github.com/ethereum-optimism/optimism/op-bindings v0.0.0 => ../op-bindings
replace github.com/ethereum/go-ethereum v1.10.17 => github.com/ethereum-optimism/reference-optimistic-geth v0.0.0-20220428214415-643b449b5818
replace github.com/ethereum-optimism/optimism/op-proposer v0.0.0 => ../op-proposer
// For local debugging:
// replace github.com/ethereum/go-ethereum v1.10.16 => ../go-ethereum
// replace github.com/ethereum/go-ethereum v1.10.17 => ../go-ethereum
......@@ -5,8 +5,8 @@ import (
"math/big"
"testing"
"github.com/ethereum-optimism/optimism/op-node/contracts/deposit"
"github.com/ethereum-optimism/optimism/op-node/contracts/l1block"
"github.com/ethereum-optimism/optimism/op-bindings/deposit"
"github.com/ethereum-optimism/optimism/op-bindings/l1block"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
......
......@@ -7,10 +7,10 @@ import (
"math/big"
"time"
"github.com/ethereum-optimism/optimism/op-node/contracts/deposit"
"github.com/ethereum-optimism/optimism/op-node/contracts/withdrawer"
"github.com/ethereum-optimism/optimism/op-bindings/deposit"
"github.com/ethereum-optimism/optimism/op-bindings/l2oo"
"github.com/ethereum-optimism/optimism/op-bindings/withdrawer"
"github.com/ethereum-optimism/optimism/op-node/predeploy"
"github.com/ethereum-optimism/optimism/op-proposer/bindings/l2oo"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
......
......@@ -19,24 +19,7 @@ test:
lint:
golangci-lint run -E asciicheck,goimports,misspell ./...
bindings: bindings-l2-output-oracle
bindings-l2-output-oracle:
$(eval temp := $(shell mktemp -d))
cd ../packages/contracts; \
forge build \
&& forge inspect L2OutputOracle abi > $(temp)/L2OutputOracle.abi \
&& forge inspect L2OutputOracle bytecode > $(temp)/L2OutputOracle.bin
abigen \
--abi $(temp)/L2OutputOracle.abi \
--bin $(temp)/L2OutputOracle.bin \
--pkg l2oo \
--type L2OutputOracle \
--out ./bindings/l2oo/l2_output_oracle.go
.PHONY: \
bindings \
bindings-mock-l2-output-oracle \
clean \
op-proposer \
test \
......
......@@ -7,8 +7,8 @@ import (
"math/big"
"strings"
"github.com/ethereum-optimism/optimism/op-bindings/l2oo"
"github.com/ethereum-optimism/optimism/op-node/l2"
"github.com/ethereum-optimism/optimism/op-proposer/bindings/l2oo"
"github.com/ethereum-optimism/optimism/op-proposer/rollupclient"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
......
......@@ -3,8 +3,9 @@ module github.com/ethereum-optimism/optimism/op-proposer
go 1.18
require (
github.com/ethereum-optimism/optimism/op-bindings v0.0.0
github.com/ethereum-optimism/optimism/op-node v0.0.0
github.com/ethereum/go-ethereum v1.10.16
github.com/ethereum/go-ethereum v1.10.17
github.com/miguelmota/go-ethereum-hdwallet v0.1.1
github.com/stretchr/testify v1.7.0
github.com/urfave/cli v1.22.5
......@@ -155,4 +156,6 @@ require (
replace github.com/ethereum-optimism/optimism/op-node v0.0.0 => ../op-node
replace github.com/ethereum/go-ethereum v1.10.16 => github.com/ethereum-optimism/reference-optimistic-geth v0.0.0-20220427171107-d0070e0a6ead
replace github.com/ethereum-optimism/optimism/op-bindings v0.0.0 => ../op-bindings
replace github.com/ethereum/go-ethereum v1.10.17 => github.com/ethereum-optimism/reference-optimistic-geth v0.0.0-20220427171107-d0070e0a6ead
......@@ -2,6 +2,7 @@ FROM golang:1.18.0-alpine3.15 as builder
RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
COPY ./op-bindings /app/op-bindings
COPY ./op-node /app/op-node
COPY ./op-proposer /app/op-proposer
COPY ./op-batcher /app/op-batcher
......
FROM ethereum/client-go:v1.10.16
FROM ethereum/client-go:v1.10.17
RUN apk add --no-cache jq
......
......@@ -5,6 +5,8 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
COPY ./op-node/go.mod /app/op-node/go.mod
COPY ./op-node/go.sum /app/op-node/go.sum
COPY ./op-bindings /app/op-bindings
WORKDIR /app/op-node
RUN go mod download -x
......
......@@ -2,6 +2,7 @@ FROM golang:1.18.0-alpine3.15 as builder
RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
COPY ./op-bindings /app/op-bindings
COPY ./op-node /app/op-node
COPY ./op-proposer /app/op-proposer
......
......@@ -2,18 +2,20 @@ FROM golang:1.18.0-alpine3.15 as builder
RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
COPY ./op-node/go.mod /app/go.mod
COPY ./op-node/go.sum /app/go.sum
COPY ./op-node/go.mod /app/op-node/go.mod
COPY ./op-node/go.sum /app/op-node/go.sum
WORKDIR /app
COPY ./op-bindings /app/op-bindings
WORKDIR /app/op-node
RUN go mod download -x
COPY ./op-node /app
COPY ./op-node /app/op-node
RUN go build -o ./bin/stateviz ./cmd/stateviz
FROM alpine:3.15
COPY --from=builder /app/bin/stateviz /usr/local/bin
COPY --from=builder /app/op-node/bin/stateviz /usr/local/bin
CMD ["stateviz"]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment