Skip to content

Commit

Permalink
gas-oracle: ci + docker build/publish
Browse files Browse the repository at this point in the history
Adds a dockerfile for the `gas-oracle` as well as adding it as
a service in the `docker-compose.yaml`. It is not enabled by
default due to memory issues in CI already happening occasionally
where the integration tests are oom killed.

The `gas-oracle` is configured with a key that owns the
`OVM_GasPriceOracle`.

This PR adds the `gas-oracle` to the Github Actions
workflow that is responsible for publishing the docker images.
  • Loading branch information
tynes committed Jul 7, 2021
1 parent ce3c353 commit c718bcd
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 1 deletion.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ tests/testdata
l2geth/signer/fourbyte
l2geth/cmd/puppeth
l2geth/cmd/clef
go/gas-oracle/gas-oracle
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
message-relayer: ${{ steps.packages.outputs.message-relayer }}
data-transport-layer: ${{ steps.packages.outputs.data-transport-layer }}
contracts: ${{ steps.packages.outputs.contracts }}
gas-oracle: ${{ steps.packages.outputs.gas-oracle }}

steps:
- name: Checkout Repo
Expand Down Expand Up @@ -100,6 +101,32 @@ jobs:
push: true
tags: ethereumoptimism/rpc-proxy:${{ needs.release.outputs.l2geth }}

gas-oracle:
name: Publish Gas Oracle Version ${{ needs.release.outputs.gas-oracle }}
needs: release
if: needs.release.outputs.gas-oracle != ''
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_SECRET }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Publish Gas Oracle
uses: docker/build-push-action@v2
with:
context: .
file: ./ops/docker/Dockerfile.gas-oracle
push: true
tags: ethereumoptimism/gas-oracle:${{ needs.release.outputs.gas-oracle }}

# pushes the base builder image to dockerhub
builder:
name: Prepare the base builder image for the services
Expand Down
13 changes: 12 additions & 1 deletion ops/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ services:
ports:
- ${VERIFIER_HTTP_PORT:-8547}:8545
- ${VERIFIER_WS_PORT:-8548}:8546

replica:
depends_on:
- dtl
Expand Down Expand Up @@ -198,3 +198,14 @@ services:
ENABLE_GAS_REPORT: 1
NO_NETWORK: 1

gas_oracle:
image: ethereumoptimism/gas-oracle
deploy:
replicas: 0
build:
context: ..
dockerfile: ./ops/docker/Dockerfile.gas-oracle
entrypoint: ./gas-oracle.sh
environment:
GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL: http://l2geth:8545
GAS_PRICE_ORACLE_PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
14 changes: 14 additions & 0 deletions ops/docker/Dockerfile.gas-oracle
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM golang:1.15-alpine3.13 as builder

RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash

ADD ./go/gas-oracle /gas-oracle
RUN cd /gas-oracle && make gas-oracle

FROM alpine:3.13

RUN apk add --no-cache ca-certificates jq curl
COPY --from=builder /gas-oracle/gas-oracle /usr/local/bin/

COPY ./ops/scripts/gas-oracle.sh .
ENTRYPOINT ["gas-oracle"]
1 change: 1 addition & 0 deletions ops/envs/geth.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ROLLUP_CLIENT_HTTP=
ROLLUP_STATE_DUMP_PATH=
ROLLUP_POLL_INTERVAL_FLAG=500ms
ROLLUP_ENABLE_L2_GAS_POLLING=true
ROLLUP_GAS_PRICE_ORACLE_OWNER_ADDRESS=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
# ROLLUP_ENFORCE_FEES=

ETHERBASE=0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf
Expand Down
20 changes: 20 additions & 0 deletions ops/scripts/gas-oracle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

RETRIES=${RETRIES:-40}

if [[ -z $GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL ]]; then
echo "Must set env GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL"
exit 1
fi

# waits for l2geth to be up
curl --fail \
--show-error \
--silent \
--retry-connrefused \
--retry $RETRIES \
--retry-delay 1 \
--output /dev/null \
$GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL

exec gas-oracle "$@"

0 comments on commit c718bcd

Please sign in to comment.