Skip to content

Commit

Permalink
Merge branch 'main' into minhd-vu/fund-l2-accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
minhd-vu authored Oct 24, 2024
2 parents cfc82c1 + 4e67dd0 commit 4a80813
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 28 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,20 +292,20 @@ jobs:
uses: ./.github/actions/setup-kurtosis-cdk

- name: Deploy L1 chain and a first CDK L2 chain (cdk-erigon sequencer + cdk stack)
run: kurtosis run --enclave=${{ env.ENCLAVE_NAME }} --show-enclave-inspect=false .
run: kurtosis run --enclave=${{ env.ENCLAVE_NAME }} .

- name: Attach a second CDK L2 chain (cdk-erigon sequencer + cdk stack)
run: kurtosis run --enclave=${{ env.ENCLAVE_NAME }} --args-file=./.github/tests/attach-second-cdk.yml --show-enclave-inspect=false .
run: kurtosis run --enclave=${{ env.ENCLAVE_NAME }} --args-file=./.github/tests/attach-second-cdk.yml .

- name: Update the agglayer config
run: |
# Download the agglayer config file.
kurtosis files download ${{ env.ENCLAVE_NAME }} agglayer-config-artifact
cd agglayer-config-artifact
# Update the config by adding the rpc and proof signer of the second chain.
tomlq -Y --toml-output --in-place '.FullNodeRPCs += {"2": "http://cdk-erigon-node-002:8123"}' agglayer-config.toml
tomlq -Y --toml-output --in-place '."full-node-rpcs" += {"2": "http://cdk-erigon-node-002:8123"}' agglayer-config.toml
# Replace the agglayer config.
agglayer_container_id="$(docker ps --filter "name=agglayer" --format "{{.ID}}")"
agglayer_container_id="$(docker ps --filter name=agglayer --format json | jq -r -s '. | map(select(.Names | startswith("agglayer--"))) | .[].ID')"
docker cp agglayer-config.toml "$agglayer_container_id:/etc/zkevm/agglayer-config.toml"
# Restart the agglayer service.
kurtosis service stop ${{ env.ENCLAVE_NAME }} agglayer
Expand Down
2 changes: 2 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ We maintain a suite of custom Docker images tailored specifically for deploying
| Fork ID | zkEVM Contracts Tag / Commit | Image |
| ------- | ---------------------------- | ----- |
| 13-RC1 | [v8.1.0-rc.1-fork.13](https://github.com/0xPolygonHermez/zkevm-contracts/tree/v8.1.0-rc.1-fork.13) | x |
| 12-PP-RC2 | [v9.0.0-rc.2-pp](https://github.com/0xPolygonHermez/zkevm-contracts/releases/tag/v9.0.0-rc.2-pp) | [leovct/zkevm-contracts:v9.0.0-rc.2-pp-fork.12](https://hub.docker.com/layers/leovct/zkevm-contracts/v9.0.0-rc.2-pp-fork.12/images/sha256-9cf68f7583029aa0b46463fe39c06310427c7afe55ba3301e2d57133ffbbf5f9?context=repo) |
| 12-PP-RC1 | [v9.0.0-rc.1-pp](https://github.com/0xPolygonHermez/zkevm-contracts/releases/tag/v9.0.0-rc.1-pp) | [leovct/zkevm-contracts:v9.0.0-rc.1-pp-fork.12](https://hub.docker.com/layers/leovct/zkevm-contracts/v9.0.0-rc.1-pp-fork.12/images/sha256-73fe48df04cb3cb631c2f5cd852c878b668ca49a477fe98278f2e0128d45b976?context=repo) |
| 12-RC4 | [v8.0.0-rc.4-fork.12](https://github.com/0xPolygonHermez/zkevm-contracts/releases/tag/v8.0.0-rc.4-fork.12) | [leovct/zkevm-contracts:v8.0.0-rc.4-fork.12](https://hub.docker.com/layers/leovct/zkevm-contracts/v8.0.0-rc.4-fork.12/images/sha256-544b2db63c608b851aa1fd9c4d4e28c63f4253e295a487c4140a6392799f336e?context=repo) |
Expand Down Expand Up @@ -41,6 +42,7 @@ The following images are deprecated:
| zkEVM Bridge UI Tag / Commit | Image |
| ---------------------------- | ----- |
| [develop@0006445](https://github.com/0xPolygonHermez/zkevm-bridge-ui/commit/0006445e1cace5c4d737523fca44af7f7261e041) | [leovct/zkevm-bridge-ui:multi-network](https://hub.docker.com/layers/leovct/zkevm-bridge-ui/multi-network/images/sha256-14b10a03862ce62d68d6e82a18416fb3f6d9ec5a24f96caf36ca0eb6d8a1b68e?context=repo) |
| [develop@0006445](https://github.com/0xPolygonHermez/zkevm-bridge-ui/commit/0006445e1cace5c4d737523fca44af7f7261e041) + [patch files](./zkevm-bridge-ui/) | [leovct/zkevm-bridge-ui:multi-network-2](https://hub.docker.com/layers/leovct/zkevm-bridge-ui/multi-network-2/images/sha256-958c78ea9f7fd5f4104cd10014ee9b5f359e9695dbdc3fff2f5b041913bf44e2?context=explore) |

## Custom Docker Images

Expand Down
23 changes: 21 additions & 2 deletions docker/zkevm-bridge-ui/deploy.sh.diff
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
diff --git a/scripts/deploy.sh b/scripts/deploy.sh
index 22e5b09..00da634 100644
index 22e5b09..b751cbd 100644
--- a/scripts/deploy.sh
+++ b/scripts/deploy.sh
@@ -21,6 +21,9 @@ echo "VITE_POLYGON_ZK_EVM_NETWORK_ID=$POLYGON_ZK_EVM_NETWORK_ID" >> $ENV_FILENAM
# BRIDGE API env vars
echo "VITE_BRIDGE_API_URL=$BRIDGE_API_URL" >> $ENV_FILENAME

+# Support for relative URLS
+echo "VITE_RESOLVE_RELATIVE_URLS=$RESOLVE_RELATIVE_URLS" >> $ENV_FILENAME
+
# FIAT EXCHANGE RATES API env vars
echo "VITE_ENABLE_FIAT_EXCHANGE_RATES=$ENABLE_FIAT_EXCHANGE_RATES" >> $ENV_FILENAME

@@ -91,17 +94,5 @@ fi
echo "Generated .env file:"
echo "$(cat /app/.env)"

-# Build app
-cd /app && npm run build
-
-# Copy nginx config
-cp /app/deployment/nginx.conf /etc/nginx/conf.d/default.conf
-
-# Copy app dist
-cp -r /app/dist/. /usr/share/nginx/html
-
-# Delete source code
-rm -rf /app
-
# Run nginx
nginx -g 'daemon off;'
2 changes: 1 addition & 1 deletion docker/zkevm-bridge-ui/env.ts.diff
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ index 034b982..bfa5d93 100644
VITE_REPORT_FORM_URL_ENTRY?: string;
+ VITE_RESOLVE_RELATIVE_URLS?: string;
}

type GetFiatExchangeRatesEnvParams = Pick<
@@ -180,6 +181,7 @@ const envToDomain = ({
VITE_REPORT_FORM_PLATFORM_ENTRY,
Expand Down
22 changes: 8 additions & 14 deletions docker/zkevm-bridge-ui/zkevm-bridge-ui.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,26 @@ ARG ZKEVM_BRIDGE_UI_TAG
WORKDIR /opt/zkevm-bridge-ui
# WARNING (DL3018): Pin versions in apk add.
# hadolint ignore=DL3018
RUN apk add --no-cache git patch \
RUN apk add --no-cache git patch nodejs npm \
&& rm -rf /var/cache/apk/* \
&& git clone --branch ${ZKEVM_BRIDGE_UI_TAG} https://github.com/0xPolygonHermez/zkevm-bridge-ui .

# STEP 2: Apply patches.
# STEP 2: Apply patches and build the app.
COPY deploy.sh.diff env.ts.diff ./
RUN patch -p1 -i deploy.sh.diff \
&& patch -p1 -i env.ts.diff
&& patch -p1 -i env.ts.diff \
&& npm install \
&& npm run build


# STEP 3: Build zkevm-bridge-ui image using the official Dockerfile.
# STEP 3: Serve the app using nginx.
FROM nginx:alpine
LABEL author="devtools@polygon.technology"
LABEL description="Enhanced zkevm-bridge-ui image with relative URLs support enabled"

# WARNING (DL3018): Pin versions in apk add.
# hadolint ignore=DL3018
RUN apk add --no-cache nodejs npm \
&& rm -rf /var/cache/apk/*
COPY --from=builder /opt/zkevm-bridge-ui/dist /usr/share/nginx/html
COPY --from=builder /opt/zkevm-bridge-ui/deployment/nginx.conf /etc/nginx/conf.d/default.conf

WORKDIR /app
COPY --from=builder /opt/zkevm-bridge-ui/package.json /opt/zkevm-bridge-ui/package-lock.json ./
COPY --from=builder /opt/zkevm-bridge-ui/scripts ./scripts
COPY --from=builder /opt/zkevm-bridge-ui/abis ./abis
RUN npm install
COPY --from=builder /opt/zkevm-bridge-ui/ .

WORKDIR /
ENTRYPOINT ["/bin/sh", "/app/scripts/deploy.sh"]
11 changes: 5 additions & 6 deletions docs/attach-multiple-cdks.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
By default, the Agglayer service will be deployed with the above deployment instructions. To create a devnet with multiple rollups attached to the agglayer:

```bash
kurtosis run --enclave=cdk --args-file=./.github/tests/attach-second-cdk.yml --show-enclave-inspect=false .
kurtosis run --enclave=cdk --args-file=./.github/tests/attach-second-cdk.yml .
```

The above command will use `attach-second-cdk.yml` as the input params which have a few tweaked parameters to attach to the existing Agglayer service.
After running the above additional deployment command, the `agglayer-config.toml` needs to be edited to settle the signed transactions from the rollups.
The above command will use `attach-second-cdk.yml` as the input params which have a few tweaked parameters to attach to the existing Agglayer service. After running the above additional deployment command, the `agglayer-config.toml` needs to be edited to settle the signed transactions from the rollups.

```bash
# Shell into the Agglayer service
Expand All @@ -20,20 +19,20 @@ vim /etc/zkevm/agglayer-config.toml
The `agglayer-config.toml` file should be changed as follows:

```bash
[FullNodeRPCs]
[full-node-rpcs]
# RPC of the first rollup node
1 = "http://cdk-erigon-node-001:8123"
# RPC of the second rollup node
2 = "http://cdk-erigon-node-002:8123"

[ProofSigners]
[proof-signers]
# Sequencer address for first rollup
1 = "0x5b06837A43bdC3dD9F114558DAf4B26ed49842Ed"
# Sequencer address for second rollup
2 = "0xA670342930242407b9984e467353044f8472055e"
```

Then restart the Agglayer service
Then restart the Agglayer service.

```bash
kurtosis service stop cdk-v1 agglayer
Expand Down
2 changes: 1 addition & 1 deletion input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ DEFAULT_IMAGES = {
"l2_contracts_image": "minhdvu/toolbox:0.0.7", # https://hub.docker.com/r/leovct/toolbox/tags
"zkevm_bridge_proxy_image": "haproxy:3.0-bookworm", # https://hub.docker.com/_/haproxy/tags
"zkevm_bridge_service_image": "hermeznetwork/zkevm-bridge-service:v0.6.0-RC1", # https://hub.docker.com/r/hermeznetwork/zkevm-bridge-service/tags
"zkevm_bridge_ui_image": "leovct/zkevm-bridge-ui:multi-network", # https://hub.docker.com/r/leovct/zkevm-bridge-ui/tags
"zkevm_bridge_ui_image": "leovct/zkevm-bridge-ui:multi-network-2", # https://hub.docker.com/r/leovct/zkevm-bridge-ui/tags
"zkevm_contracts_image": "leovct/zkevm-contracts:v8.0.0-rc.4-fork.12", # https://hub.docker.com/repository/docker/leovct/zkevm-contracts/tags
"zkevm_da_image": "0xpolygon/cdk-data-availability:0.0.10", # https://hub.docker.com/r/0xpolygon/cdk-data-availability/tags
"zkevm_node_image": "hermeznetwork/zkevm-node:v0.7.3", # https://hub.docker.com/r/hermeznetwork/zkevm-node/tags
Expand Down

0 comments on commit 4a80813

Please sign in to comment.