From 2c2a97c2608ab0c83f2322af2a0dc2bf0b15ea31 Mon Sep 17 00:00:00 2001 From: Tristan-Wilson <87238672+Tristan-Wilson@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:52:21 +0200 Subject: [PATCH 01/11] Add clabot config (#90) --- .clabot | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .clabot diff --git a/.clabot b/.clabot new file mode 100644 index 00000000..55cb5e61 --- /dev/null +++ b/.clabot @@ -0,0 +1,5 @@ +{ + "contributors": "https://api.github.com/repos/OffchainLabs/clabot-config/contents/nitro-contributors.json", + "message": "We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please sign the linked documents below to get yourself added. https://na3.docusign.net/Member/PowerFormSigning.aspx?PowerFormId=b15c81cc-b5ea-42a6-9107-3992526f2898&env=na3&acct=6e152afc-6284-44af-a4c1-d8ef291db402&v=2", + "label": "s" +} From 0bf1e59607509c45e97d8b219f851eb40c7daafa Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Tue, 27 Aug 2024 14:59:16 -0300 Subject: [PATCH 02/11] Fix ci cache key --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd2eb2a4..c99e474e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: uses: actions/cache@v3 with: path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ hashFiles('Dockerfile') }} + key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }} restore-keys: ${{ runner.os }}-buildx- - name: Startup Nitro testnode From 3552cb84c70ee894c9465874ff2006c028621985 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Wed, 28 Aug 2024 10:37:44 -0300 Subject: [PATCH 03/11] Removes unnecessary scripts build --- test-node.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-node.bash b/test-node.bash index 12062b5a..d40484a8 100755 --- a/test-node.bash +++ b/test-node.bash @@ -366,7 +366,7 @@ if $blockscout; then fi if $build_node_images; then - docker compose build --no-rm $NODES scripts + docker compose build --no-rm $NODES fi if $force_init; then From 8916287065d944c13d61ee482ab2008b01361180 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Wed, 28 Aug 2024 10:39:20 -0300 Subject: [PATCH 04/11] Workaround to cache docker layers in CI when using docker-compose --- .github/workflows/testnode.bash | 2 +- docker-compose-ci-cache.json | 37 +++++++++++++++++++++++++++++++++ test-node.bash | 17 ++++++++++++--- 3 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 docker-compose-ci-cache.json diff --git a/.github/workflows/testnode.bash b/.github/workflows/testnode.bash index be7e6961..63e5edf3 100755 --- a/.github/workflows/testnode.bash +++ b/.github/workflows/testnode.bash @@ -5,7 +5,7 @@ # Start the test node and get PID, to terminate it once send-l2 is done. cd ${GITHUB_WORKSPACE} -./test-node.bash "$@" +./test-node.bash "$@" --ci if [ $? -ne 0 ]; then echo "test-node.bash failed" diff --git a/docker-compose-ci-cache.json b/docker-compose-ci-cache.json new file mode 100644 index 00000000..0fee603d --- /dev/null +++ b/docker-compose-ci-cache.json @@ -0,0 +1,37 @@ +{ + "target": { + "scripts": { + "cache-from": [ + "type=local,src=/tmp/.buildx-cache" + ], + "cache-to": [ + "type=local,dest=/tmp/.buildx-cache,mode=max" + ], + "output": [ + "type=docker" + ] + }, + "rollupcreator": { + "cache-from": [ + "type=local,src=/tmp/.buildx-cache" + ], + "cache-to": [ + "type=local,dest=/tmp/.buildx-cache,mode=max" + ], + "output": [ + "type=docker" + ] + }, + "tokenbridge": { + "cache-from": [ + "type=local,src=/tmp/.buildx-cache" + ], + "cache-to": [ + "type=local,dest=/tmp/.buildx-cache,mode=max" + ], + "output": [ + "type=docker" + ] + } + } +} diff --git a/test-node.bash b/test-node.bash index d40484a8..58cb2ef1 100755 --- a/test-node.bash +++ b/test-node.bash @@ -36,6 +36,7 @@ else fi run=true +ci=false validate=false detach=false blockscout=false @@ -107,6 +108,10 @@ while [[ $# -gt 0 ]]; do done fi ;; + --ci) + ci=true + shift + ;; --build) build_dev_nitro=true build_dev_blockscout=true @@ -342,11 +347,17 @@ if $build_utils; then if $tokenbridge || $l3_token_bridge; then LOCAL_BUILD_NODES="$LOCAL_BUILD_NODES tokenbridge" fi - UTILS_NOCACHE="" - if $force_build_utils; then + + if [ "$ci" == true ]; then + # workaround to cache docker layers and keep using docker-compose in CI + docker buildx bake --file docker-compose.yaml --file docker-compose-ci-cache.json $LOCAL_BUILD_NODES + else + UTILS_NOCACHE="" + if $force_build_utils; then UTILS_NOCACHE="--no-cache" + fi + docker compose build --no-rm $UTILS_NOCACHE $LOCAL_BUILD_NODES fi - docker compose build --no-rm $UTILS_NOCACHE $LOCAL_BUILD_NODES fi if $dev_nitro; then From df50256e41469ffbe810830bcb61831ce7b84866 Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Wed, 9 Oct 2024 16:38:38 +0530 Subject: [PATCH 05/11] Add option to run simple/no-simple in CI --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd2eb2a4..b9ec2133 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,7 @@ jobs: pos: [pos, no-pos] l3node: [l3node, l3node-token-6, no-l3node] tokenbridge: [tokenbridge, no-tokenbridge] + simple: [simple, no-simple] steps: - name: Checkout @@ -38,4 +39,4 @@ jobs: restore-keys: ${{ runner.os }}-buildx- - name: Startup Nitro testnode - run: ${{ github.workspace }}/.github/workflows/testnode.bash --init-force ${{ (matrix.l3node == 'l3node' && '--l3node') || (matrix.l3node == 'l3node-token-6' && '--l3node --l3-fee-token --l3-token-bridge --l3-fee-token-decimals 6') || '' }} ${{ matrix.tokenbridge == 'tokenbridge' && '--tokenbridge' || '--no-tokenbridge' }} --no-simple --detach ${{ matrix.pos == 'pos' && '--pos' || '' }} + run: ${{ github.workspace }}/.github/workflows/testnode.bash --init-force ${{ (matrix.l3node == 'l3node' && '--l3node') || (matrix.l3node == 'l3node-token-6' && '--l3node --l3-fee-token --l3-token-bridge --l3-fee-token-decimals 6') || '' }} ${{ matrix.tokenbridge == 'tokenbridge' && '--tokenbridge' || '--no-tokenbridge' }} --detach ${{ matrix.pos == 'pos' && '--pos' || '' }} --simple ${{ (matrix.simple == 'simple' && '--simple') || (matrix.simple == 'no-simple' && '--no-simple') || '' }} From f7ffe6111e01b2870d3f81d959c4f54c8906928b Mon Sep 17 00:00:00 2001 From: spsjvc Date: Tue, 15 Oct 2024 13:24:49 +0200 Subject: [PATCH 06/11] Change geth ref from latest to stable --- docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index f8facecc..c3cbf4cf 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -47,7 +47,7 @@ services: - "127.0.0.1:6379:6379" geth: - image: ethereum/client-go:latest + image: ethereum/client-go:stable ports: - "127.0.0.1:8545:8545" - "127.0.0.1:8551:8551" From 45d722f8d138db3556212411bd387547b0119367 Mon Sep 17 00:00:00 2001 From: gzeon Date: Tue, 29 Oct 2024 05:14:44 +0900 Subject: [PATCH 07/11] perf: common docker layer --- rollupcreator/Dockerfile | 2 +- tokenbridge/Dockerfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rollupcreator/Dockerfile b/rollupcreator/Dockerfile index f6406dad..622eafb6 100644 --- a/rollupcreator/Dockerfile +++ b/rollupcreator/Dockerfile @@ -1,7 +1,7 @@ FROM node:18-bullseye-slim -ARG NITRO_CONTRACTS_BRANCH=main RUN apt-get update && \ apt-get install -y git docker.io python3 build-essential curl jq +ARG NITRO_CONTRACTS_BRANCH=main WORKDIR /workspace RUN git clone --no-checkout https://github.com/OffchainLabs/nitro-contracts.git ./ RUN git checkout ${NITRO_CONTRACTS_BRANCH} diff --git a/tokenbridge/Dockerfile b/tokenbridge/Dockerfile index dac06fbb..38d417f1 100644 --- a/tokenbridge/Dockerfile +++ b/tokenbridge/Dockerfile @@ -1,7 +1,7 @@ FROM node:18-bullseye-slim -ARG TOKEN_BRIDGE_BRANCH=main RUN apt-get update && \ - apt-get install -y git docker.io python3 build-essential + apt-get install -y git docker.io python3 build-essential curl jq +ARG TOKEN_BRIDGE_BRANCH=main WORKDIR /workspace RUN git clone --no-checkout https://github.com/OffchainLabs/token-bridge-contracts.git ./ RUN git checkout ${TOKEN_BRIDGE_BRANCH} From 904e65d6a1af906be9472a4fb38797b2424e9fe0 Mon Sep 17 00:00:00 2001 From: gzeon Date: Tue, 29 Oct 2024 06:42:32 +0900 Subject: [PATCH 08/11] fix: init --- test-node.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-node.bash b/test-node.bash index 58cb2ef1..0ea81cb5 100755 --- a/test-node.bash +++ b/test-node.bash @@ -71,13 +71,13 @@ while [[ $# -gt 0 ]]; do read -p "are you sure? [y/n]" -n 1 response if [[ $response == "y" ]] || [[ $response == "Y" ]]; then force_init=true - build_utils=true - build_node_images=true echo else exit 0 fi fi + build_utils=true + build_node_images=true shift ;; --init-force) From a911bc9455c4072a6a2f3ceffa47b4b33819ab93 Mon Sep 17 00:00:00 2001 From: gzeon Date: Tue, 5 Nov 2024 18:58:34 +0900 Subject: [PATCH 09/11] fix: build cache missing tokenbridge --- test-node.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test-node.bash b/test-node.bash index 0ea81cb5..d885ba87 100755 --- a/test-node.bash +++ b/test-node.bash @@ -344,7 +344,8 @@ fi if $build_utils; then LOCAL_BUILD_NODES="scripts rollupcreator" - if $tokenbridge || $l3_token_bridge; then + # always build tokenbridge in CI mode to avoid caching issues + if $tokenbridge || $l3_token_bridge || $ci; then LOCAL_BUILD_NODES="$LOCAL_BUILD_NODES tokenbridge" fi From f40e37dd2ca37c30adfdcdd9105399f6238ac073 Mon Sep 17 00:00:00 2001 From: gzeon Date: Tue, 5 Nov 2024 18:59:43 +0900 Subject: [PATCH 10/11] fix: allow detach without waiting --- test-node.bash | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test-node.bash b/test-node.bash index d885ba87..91945e0e 100755 --- a/test-node.bash +++ b/test-node.bash @@ -39,6 +39,7 @@ run=true ci=false validate=false detach=false +nowait=false blockscout=false tokenbridge=false l3node=false @@ -179,6 +180,14 @@ while [[ $# -gt 0 ]]; do detach=true shift ;; + --nowait) + if ! $detach; then + echo "Error: --nowait requires --detach to be provided." + exit 1 + fi + nowait=true + shift + ;; --batchposters) simple=false batchposters=$2 @@ -557,7 +566,11 @@ fi if $run; then UP_FLAG="" if $detach; then - UP_FLAG="--wait" + if $nowait; then + UP_FLAG="--detach" + else + UP_FLAG="--wait" + fi fi echo == Launching Sequencer From e096877744268af6eaa1a3cfc16e2c95a9a7299f Mon Sep 17 00:00:00 2001 From: gzeon Date: Tue, 5 Nov 2024 19:00:54 +0900 Subject: [PATCH 11/11] perf: further reduce layer size --- rollupcreator/Dockerfile | 4 ++-- tokenbridge/Dockerfile | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/rollupcreator/Dockerfile b/rollupcreator/Dockerfile index 622eafb6..13150b58 100644 --- a/rollupcreator/Dockerfile +++ b/rollupcreator/Dockerfile @@ -1,14 +1,14 @@ FROM node:18-bullseye-slim RUN apt-get update && \ - apt-get install -y git docker.io python3 build-essential curl jq + apt-get install -y git docker.io python3 make gcc g++ curl jq ARG NITRO_CONTRACTS_BRANCH=main WORKDIR /workspace RUN git clone --no-checkout https://github.com/OffchainLabs/nitro-contracts.git ./ RUN git checkout ${NITRO_CONTRACTS_BRANCH} +RUN yarn install && yarn cache clean RUN curl -L https://foundry.paradigm.xyz | bash ENV PATH="${PATH}:/root/.foundry/bin" RUN foundryup RUN touch scripts/config.ts -RUN yarn install RUN yarn build:all ENTRYPOINT ["yarn"] diff --git a/tokenbridge/Dockerfile b/tokenbridge/Dockerfile index 38d417f1..4adce556 100644 --- a/tokenbridge/Dockerfile +++ b/tokenbridge/Dockerfile @@ -1,10 +1,12 @@ FROM node:18-bullseye-slim RUN apt-get update && \ - apt-get install -y git docker.io python3 build-essential curl jq + apt-get install -y git docker.io python3 make gcc g++ curl jq ARG TOKEN_BRIDGE_BRANCH=main WORKDIR /workspace -RUN git clone --no-checkout https://github.com/OffchainLabs/token-bridge-contracts.git ./ -RUN git checkout ${TOKEN_BRIDGE_BRANCH} -RUN yarn install +RUN git clone --no-checkout https://github.com/OffchainLabs/token-bridge-contracts.git ./ && \ + git checkout ${TOKEN_BRIDGE_BRANCH} && \ + rm -rf .git && \ + git init && git add . && git -c user.name="user" -c user.email="user@example.com" commit -m "Initial commit" +RUN yarn install && yarn cache clean RUN yarn build ENTRYPOINT ["yarn"]