diff --git a/.dockerignore b/.dockerignore index 6743725724c5..d9185447b480 100644 --- a/.dockerignore +++ b/.dockerignore @@ -12,3 +12,4 @@ tests/testdata l2geth/signer/fourbyte l2geth/cmd/puppeth l2geth/cmd/clef +go/gas-oracle/gas-oracle diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 65bfc5216d1f..ef551cebd9fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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 diff --git a/ops/docker-compose.yml b/ops/docker-compose.yml index 9791365d6404..152c82dc0d8c 100644 --- a/ops/docker-compose.yml +++ b/ops/docker-compose.yml @@ -157,7 +157,7 @@ services: ports: - ${VERIFIER_HTTP_PORT:-8547}:8545 - ${VERIFIER_WS_PORT:-8548}:8546 - + replica: depends_on: - dtl @@ -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" diff --git a/ops/docker/Dockerfile.gas-oracle b/ops/docker/Dockerfile.gas-oracle new file mode 100644 index 000000000000..23af993d2068 --- /dev/null +++ b/ops/docker/Dockerfile.gas-oracle @@ -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"] diff --git a/ops/envs/geth.env b/ops/envs/geth.env index 6c0a2dfadcb5..60e7c50e59f7 100644 --- a/ops/envs/geth.env +++ b/ops/envs/geth.env @@ -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 diff --git a/ops/scripts/gas-oracle.sh b/ops/scripts/gas-oracle.sh new file mode 100755 index 000000000000..a8ed6c5d27fb --- /dev/null +++ b/ops/scripts/gas-oracle.sh @@ -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 "$@"