From 4095efdb3e459f2e93e7352111309cc836b44876 Mon Sep 17 00:00:00 2001 From: nmjustinchan Date: Fri, 22 Nov 2024 12:53:11 +1100 Subject: [PATCH 1/8] feat: add taiko protocol action --- .../taiko-protocol--docker-build.yml | 97 +++++++++++++++++++ packages/protocol/Dockerfile | 17 ++++ .../layer1/tiers/TierProviderBase.sol | 2 +- 3 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/taiko-protocol--docker-build.yml create mode 100644 packages/protocol/Dockerfile diff --git a/.github/workflows/taiko-protocol--docker-build.yml b/.github/workflows/taiko-protocol--docker-build.yml new file mode 100644 index 00000000000..b6a16d62f5c --- /dev/null +++ b/.github/workflows/taiko-protocol--docker-build.yml @@ -0,0 +1,97 @@ +name: "[Nethermind] Taiko Protocol - Docker build and push" + +on: + workflow_dispatch: + push: + branches: [main] + tags: + - "taiko-protocol-v*" + paths: + - "packages/protocol/**" + +env: + DOCKER_REGISTRY: nethermind.jfrog.io + DOCKER_USERNAME: modular + DOCKER_REPOSITORY_DEV: modular-oci-local-dev/taiko-protocol + DOCKER_REPOSITORY_STAGING: modular-oci-local-staging/taiko-protocol + +jobs: + build: + name: Build and push docker image + runs-on: ubuntu-latest + if: github.repository == 'NethermindEth/surge-taiko-mono' + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - uses: docker/login-action@v3 + with: + registry: ${{ env.DOCKER_REGISTRY }} + username: ${{ env.DOCKER_USERNAME }} + password: ${{ secrets.ARTIFACTORY_MODULAR_TOKEN_DEVELOPER }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REPOSITORY_DEV }} + tags: | + type=raw,value=latest + type=ref,event=branch + type=ref,event=pr + type=ref,event=tag + type=sha + + - name: Build and push by digest + id: build + uses: docker/build-push-action@v5 + with: + platforms: linux/amd64,linux/arm64 + context: . + file: packages/protocol/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - uses: oras-project/setup-oras@v1 + - run: oras version + - name: Login to registry with oras + run: | + oras login ${{ env.DOCKER_REGISTRY }} \ + -u ${{ env.DOCKER_USERNAME }} \ + -p ${{ secrets.ARTIFACTORY_MODULAR_TOKEN_DEVELOPER }} + + - name: Promote to Staging + run: | + # Read tags line by line using a while loop + echo "${{ steps.meta.outputs.tags }}" | while IFS= read -r tag; do + echo "Current tag: $tag" + # Trim any whitespace from the tag + tag=$(echo "$tag" | xargs) + + # Extract the tag suffix (everything after the last colon) + tag_suffix="${tag##*:}" + + # Construct source and destination tags + source_image="${DOCKER_REGISTRY}/${DOCKER_REPOSITORY_DEV}:${tag_suffix}" + staging_image="${DOCKER_REGISTRY}/${DOCKER_REPOSITORY_STAGING}:${tag_suffix}" + + echo "Promoting ${source_image} to ${staging_image}" + oras cp -r "${source_image}" "${staging_image}" + done + + - name: Summary + run: | + echo "## Docker build completed :green_circle:" >> $GITHUB_STEP_SUMMARY + echo "### Tags" >> $GITHUB_STEP_SUMMARY + echo "${{ steps.meta.outputs.tags }}" | while IFS= read -r TAG; do + echo "- $TAG" >> $GITHUB_STEP_SUMMARY + done + echo "### Notes" >> $GITHUB_STEP_SUMMARY + echo "- The images have also been pushed to ${DOCKER_REPOSITORY_STAGING} repo" >> $GITHUB_STEP_SUMMARY diff --git a/packages/protocol/Dockerfile b/packages/protocol/Dockerfile new file mode 100644 index 00000000000..53e4a4281c6 --- /dev/null +++ b/packages/protocol/Dockerfile @@ -0,0 +1,17 @@ +FROM node:22 + +WORKDIR /app + +COPY . . + +RUN git init && \ + curl -L https://foundry.paradigm.xyz | bash && \ + npm install -g pnpm && \ + . ~/.bashrc && \ + foundryup && \ + forge install && \ + pnpm install + +ENV PATH="/root/.foundry/bin:$PATH" + +CMD ["sh", "-c", "echo Please verify the environment variables and command."] diff --git a/packages/protocol/contracts/layer1/tiers/TierProviderBase.sol b/packages/protocol/contracts/layer1/tiers/TierProviderBase.sol index 5e5130c63fd..6adda677e0d 100644 --- a/packages/protocol/contracts/layer1/tiers/TierProviderBase.sol +++ b/packages/protocol/contracts/layer1/tiers/TierProviderBase.sol @@ -95,7 +95,7 @@ abstract contract TierProviderBase is ITierProvider { verifierName: _verifierName, validityBond: _validityBond, contestBond: _validityBond / 10_000 * 65_625, - cooldownWindow: _cooldownWindow, + cooldownWindow: 0, provingWindow: GRACE_PERIOD + _provingWindow, maxBlocksToVerifyPerProof: 0 }); From a9fc98ab12e95aed2b6bfbb61038f5c060d332b4 Mon Sep 17 00:00:00 2001 From: nmjustinchan Date: Fri, 22 Nov 2024 12:58:42 +1100 Subject: [PATCH 2/8] feat: update ci --- .github/workflows/taiko-protocol--docker-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/taiko-protocol--docker-build.yml b/.github/workflows/taiko-protocol--docker-build.yml index b6a16d62f5c..05ca2553c66 100644 --- a/.github/workflows/taiko-protocol--docker-build.yml +++ b/.github/workflows/taiko-protocol--docker-build.yml @@ -3,7 +3,7 @@ name: "[Nethermind] Taiko Protocol - Docker build and push" on: workflow_dispatch: push: - branches: [main] + branches: [justin/protocol-deployment] tags: - "taiko-protocol-v*" paths: From 56ae072cf6c05aa05c64df56b786a7ef20dfc8df Mon Sep 17 00:00:00 2001 From: nmjustinchan Date: Fri, 22 Nov 2024 13:48:41 +1100 Subject: [PATCH 3/8] debug: push procotol action --- .github/workflows/taiko-protocol--docker-build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/taiko-protocol--docker-build.yml b/.github/workflows/taiko-protocol--docker-build.yml index 05ca2553c66..705967492d3 100644 --- a/.github/workflows/taiko-protocol--docker-build.yml +++ b/.github/workflows/taiko-protocol--docker-build.yml @@ -3,17 +3,17 @@ name: "[Nethermind] Taiko Protocol - Docker build and push" on: workflow_dispatch: push: - branches: [justin/protocol-deployment] + branches: [main] tags: - - "taiko-protocol-v*" + - "taiko-client-v*" paths: - - "packages/protocol/**" + - "packages/taiko-client/**" env: DOCKER_REGISTRY: nethermind.jfrog.io DOCKER_USERNAME: modular - DOCKER_REPOSITORY_DEV: modular-oci-local-dev/taiko-protocol - DOCKER_REPOSITORY_STAGING: modular-oci-local-staging/taiko-protocol + DOCKER_REPOSITORY_DEV: modular-oci-local-dev/taiko-client + DOCKER_REPOSITORY_STAGING: modular-oci-local-staging/taiko-client jobs: build: @@ -54,7 +54,7 @@ jobs: with: platforms: linux/amd64,linux/arm64 context: . - file: packages/protocol/Dockerfile + file: packages/taiko-client/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 215cf19d45369e3ea9079b5b35a5dd65b21b77c7 Mon Sep 17 00:00:00 2001 From: Justin Chan <147025745+nmjustinchan@users.noreply.github.com> Date: Fri, 22 Nov 2024 14:04:51 +1100 Subject: [PATCH 4/8] Update taiko-protocol--docker-build.yml --- .github/workflows/taiko-protocol--docker-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/taiko-protocol--docker-build.yml b/.github/workflows/taiko-protocol--docker-build.yml index 705967492d3..43ebc7d950c 100644 --- a/.github/workflows/taiko-protocol--docker-build.yml +++ b/.github/workflows/taiko-protocol--docker-build.yml @@ -5,9 +5,9 @@ on: push: branches: [main] tags: - - "taiko-client-v*" + - "taiko-protocol-v*" paths: - - "packages/taiko-client/**" + - "packages/protocol/**" env: DOCKER_REGISTRY: nethermind.jfrog.io @@ -54,7 +54,7 @@ jobs: with: platforms: linux/amd64,linux/arm64 context: . - file: packages/taiko-client/Dockerfile + file: packages/protocol/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 3241c25439907cf09358e25afb3ead85e2a96d32 Mon Sep 17 00:00:00 2001 From: nmjustinchan Date: Fri, 22 Nov 2024 14:10:39 +1100 Subject: [PATCH 5/8] debug: test workflow --- .github/workflows/test.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000000..4b1b5838d93 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,14 @@ +name: Debug Workflow + +on: + workflow_dispatch: + +jobs: + debug: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Print Hello World + run: echo "Hello, World!" From d886fbf629f4b6b428ad810c43dd5f7f11892673 Mon Sep 17 00:00:00 2001 From: nmjustinchan Date: Fri, 22 Nov 2024 20:40:30 +1100 Subject: [PATCH 6/8] debug: remove test and modify protocol docker build context --- .github/workflows/taiko-protocol--docker-build.yml | 4 ++-- .github/workflows/test.yml | 14 -------------- 2 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/taiko-protocol--docker-build.yml b/.github/workflows/taiko-protocol--docker-build.yml index 43ebc7d950c..de80e1a9fc0 100644 --- a/.github/workflows/taiko-protocol--docker-build.yml +++ b/.github/workflows/taiko-protocol--docker-build.yml @@ -53,8 +53,8 @@ jobs: uses: docker/build-push-action@v5 with: platforms: linux/amd64,linux/arm64 - context: . - file: packages/protocol/Dockerfile + context: ./packages/protocol + file: Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 4b1b5838d93..00000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Debug Workflow - -on: - workflow_dispatch: - -jobs: - debug: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Print Hello World - run: echo "Hello, World!" From fb15997f3f48c056541fc367cc3744fb71ac8542 Mon Sep 17 00:00:00 2001 From: nmjustinchan Date: Fri, 22 Nov 2024 20:43:38 +1100 Subject: [PATCH 7/8] refac: revert cool down window for tier --- packages/protocol/contracts/layer1/tiers/TierProviderBase.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol/contracts/layer1/tiers/TierProviderBase.sol b/packages/protocol/contracts/layer1/tiers/TierProviderBase.sol index 6adda677e0d..5e5130c63fd 100644 --- a/packages/protocol/contracts/layer1/tiers/TierProviderBase.sol +++ b/packages/protocol/contracts/layer1/tiers/TierProviderBase.sol @@ -95,7 +95,7 @@ abstract contract TierProviderBase is ITierProvider { verifierName: _verifierName, validityBond: _validityBond, contestBond: _validityBond / 10_000 * 65_625, - cooldownWindow: 0, + cooldownWindow: _cooldownWindow, provingWindow: GRACE_PERIOD + _provingWindow, maxBlocksToVerifyPerProof: 0 }); From 553261370dd0e47cb145c04b2a24a99ce62ecf58 Mon Sep 17 00:00:00 2001 From: nmjustinchan Date: Fri, 22 Nov 2024 20:46:02 +1100 Subject: [PATCH 8/8] fix: update Docker repo --- .github/workflows/taiko-protocol--docker-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/taiko-protocol--docker-build.yml b/.github/workflows/taiko-protocol--docker-build.yml index de80e1a9fc0..f7cf9985524 100644 --- a/.github/workflows/taiko-protocol--docker-build.yml +++ b/.github/workflows/taiko-protocol--docker-build.yml @@ -12,8 +12,8 @@ on: env: DOCKER_REGISTRY: nethermind.jfrog.io DOCKER_USERNAME: modular - DOCKER_REPOSITORY_DEV: modular-oci-local-dev/taiko-client - DOCKER_REPOSITORY_STAGING: modular-oci-local-staging/taiko-client + DOCKER_REPOSITORY_DEV: modular-oci-local-dev/taiko-protocol + DOCKER_REPOSITORY_STAGING: modular-oci-local-staging/taiko-protocol jobs: build: