Skip to content

Commit 14fc751

Browse files
authored
release zksync os (#4212)
## What ❔ Release zksync os prover and server. For using it later in demo stands. ## Why ❔ <!-- Why are these changes done? What goal do they contribute to? What are the principles behind them? --> <!-- The `Why` has to be clear to non-Matter Labs entities running their own ZK Chain --> <!-- Example: PR templates ensure PR reviewers, observers, and future iterators are in context about the evolution of repos. --> ## Is this a breaking change? - [ ] Yes - [ ] No ## Operational changes <!-- Any config changes? Any new flags? Any changes to any scripts? --> <!-- Please add anything that non-Matter Labs entities running their own ZK Chain may need to know --> ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zkstack dev fmt` and `zkstack dev lint`. --------- Signed-off-by: Danil <[email protected]>
1 parent f36bc50 commit 14fc751

File tree

11 files changed

+369
-7
lines changed

11 files changed

+369
-7
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ keys/setup
1717
!db/
1818
!backups/
1919
!core/
20+
!zkos_prover/
2021
!prover/
2122
!yarn.lock
2223
!package.json
@@ -48,3 +49,6 @@ contracts/.git
4849
!etc/env/consensus_secrets.yaml
4950
!etc/env/consensus_config.yaml
5051
!rust-toolchain
52+
!execution_environment/*
53+
!app.bin
54+
!app_logging_enabled.bin

.github/workflows/build-core-template.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ on:
2727
type: string
2828
required: false
2929
default: "do nothing"
30+
zksync_os:
31+
description: 'Flag that determines if zksync-os should be built'
32+
type: boolean
33+
required: false
34+
default: false
3035

3136
jobs:
3237
prepare-contracts:
@@ -46,6 +51,7 @@ jobs:
4651
echo $HOME/.local/bin >> $GITHUB_PATH
4752
echo CI=1 >> .env
4853
echo IN_DOCKER=1 >> .env
54+
echo RUSTFLAGS="" >> .env
4955
5056
- name: Download contracts
5157
shell: bash
@@ -133,7 +139,7 @@ jobs:
133139
if: env.BUILD_CONTRACTS == 'true'
134140
run: |
135141
./zkstack_cli/zkstackup/install --path ./zkstack_cli/zkstackup/zkstackup
136-
zkstackup --local || true
142+
RUSTFLAGS="" zkstackup --local || true
137143
138144
- name: build contracts
139145
if: env.BUILD_CONTRACTS == 'true'
@@ -153,7 +159,7 @@ jobs:
153159
name: Build and Push Docker Images
154160
needs: prepare-contracts
155161
env:
156-
IMAGE_TAG_SUFFIX: ${{ inputs.image_tag_suffix }}${{ (inputs.en_alpha_release && matrix.components == 'external-node') && '-alpha' || '' }}
162+
IMAGE_TAG_SUFFIX: ${{ inputs.zksync_os && 'zksync_os-' || '' }}${{ inputs.image_tag_suffix }}${{ (inputs.en_alpha_release && matrix.components == 'external-node') && '-alpha' || '' }}
157163
runs-on: ${{ fromJSON('["matterlabs-ci-runner-high-performance", "matterlabs-ci-runner-arm"]')[contains(matrix.platforms, 'arm')] }}
158164
permissions:
159165
packages: write
@@ -164,6 +170,7 @@ jobs:
164170
- server-v2
165171
- external-node
166172
- snapshots-creator
173+
- zksync-os-server
167174
platforms:
168175
- linux/amd64
169176
include:
@@ -240,9 +247,10 @@ jobs:
240247
SCCACHE_GCS_SERVICE_ACCOUNT=gha-ci-runners@matterlabs-infra.iam.gserviceaccount.com
241248
SCCACHE_GCS_RW_MODE=READ_WRITE
242249
RUSTC_WRAPPER=sccache
243-
tags: |
250+
tags: |
244251
us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.components }}:${{ env.IMAGE_TAG_SHA_TS }}-${{ env.PLATFORM }}
245252
ghcr.io/${{ github.repository_owner }}/${{ matrix.components }}:${{ env.IMAGE_TAG_SHA_TS }}-${{ env.PLATFORM }}
253+
ghcr.io/${{ github.repository_owner }}/${{ matrix.components }}:${{ inputs.zksync_os && 'zksync_os-' || '' }}latest
246254
matterlabs/${{ matrix.components }}:${{ env.IMAGE_TAG_SHA_TS }}-${{ env.PLATFORM }}
247255
248256
- name: Push docker image
@@ -251,6 +259,7 @@ jobs:
251259
docker push us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.components }}:${{ env.IMAGE_TAG_SHA_TS }}-${{ env.PLATFORM }}
252260
docker push matterlabs/${{ matrix.components }}:${{ env.IMAGE_TAG_SHA_TS }}-${{ env.PLATFORM }}
253261
docker push ghcr.io/${{ github.repository_owner }}/${{ matrix.components }}:${{ env.IMAGE_TAG_SHA_TS }}-${{ env.PLATFORM }}
262+
docker push ghcr.io/${{ github.repository_owner }}/${{ matrix.components }}:${{ inputs.zksync_os && 'zksync_os-' || '' }}latest
254263
255264
create_manifest:
256265
name: Create release manifest
@@ -262,13 +271,15 @@ jobs:
262271
component:
263272
- name: server-v2
264273
platform: linux/amd64
274+
- name: zksync-os-server
275+
platform: linux/amd64
265276
- name: external-node
266277
platform: linux/amd64,linux/arm64
267278
- name: snapshots-creator
268279
platform: linux/amd64
269280

270281
env:
271-
IMAGE_TAG_SUFFIX: ${{ inputs.image_tag_suffix }}${{ (inputs.en_alpha_release && matrix.component.name == 'external-node') && '-alpha' || '' }}
282+
IMAGE_TAG_SUFFIX: ${{ inputs.zksync_os && 'zksync_os-' || '' }}${{ inputs.image_tag_suffix }}${{ (inputs.en_alpha_release && matrix.component.name == 'external-node') && '-alpha' || '' }}
272283
steps:
273284
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
274285

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Build Prover images
2+
on:
3+
workflow_call:
4+
secrets:
5+
DOCKERHUB_USER:
6+
description: "DOCKERHUB_USER"
7+
required: true
8+
DOCKERHUB_TOKEN:
9+
description: "DOCKERHUB_TOKEN"
10+
required: true
11+
inputs:
12+
image_tag_suffix:
13+
description: "Optional suffix to override tag name generation"
14+
type: string
15+
required: false
16+
action:
17+
description: "Action with docker image"
18+
type: string
19+
default: "push"
20+
required: false
21+
22+
jobs:
23+
build-images:
24+
name: Build and Push Docker Images
25+
runs-on: [ matterlabs-ci-runner-high-performance ]
26+
permissions:
27+
packages: write
28+
contents: read
29+
steps:
30+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
with:
32+
submodules: "recursive"
33+
34+
- name: Set up Docker Buildx
35+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
36+
37+
- name: setup-env
38+
run: |
39+
echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV
40+
echo CI=1 >> $GITHUB_ENV
41+
echo $(pwd)/bin >> $GITHUB_PATH
42+
echo CI=1 >> .env
43+
echo IN_DOCKER=1 >> .env
44+
45+
- name: Set env vars
46+
shell: bash
47+
run: |
48+
# Support for custom tag suffix
49+
if [ -n "${{ inputs.image_tag_suffix }}" ]; then
50+
echo IMAGE_TAG_SHA_TS="${{ inputs.image_tag_suffix }}" >> $GITHUB_ENV
51+
else
52+
echo IMAGE_TAG_SHA_TS=$(git rev-parse --short HEAD)-$(date +%s) >> $GITHUB_ENV
53+
fi
54+
55+
- name: login to Docker registries
56+
if: ${{ inputs.action == 'push' }}
57+
shell: bash
58+
run: |
59+
docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }}
60+
gcloud auth configure-docker us-docker.pkg.dev -q
61+
62+
- name: Login to GitHub Container Registry
63+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
64+
if: ${{ inputs.action == 'push' }}
65+
with:
66+
registry: ghcr.io
67+
username: ${{ github.actor }}
68+
password: ${{ secrets.GITHUB_TOKEN }}
69+
70+
- name: Build and push
71+
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
72+
with:
73+
context: .
74+
load: true
75+
build-args: |
76+
SCCACHE_GCS_BUCKET=matterlabs-infra-sccache-storage
77+
SCCACHE_GCS_SERVICE_ACCOUNT=gha-ci-runners@matterlabs-infra.iam.gserviceaccount.com
78+
SCCACHE_GCS_RW_MODE=READ_WRITE
79+
RUSTC_WRAPPER=sccache
80+
file: docker/zksync-os-prover/Dockerfile
81+
tags: |
82+
us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/zksync-os-prover:${{ env.IMAGE_TAG_SHA_TS }}
83+
ghcr.io/${{ github.repository_owner }}/zksync-os-prover:${{ env.IMAGE_TAG_SHA_TS }}
84+
ghcr.io/${{ github.repository_owner }}/zksync-os-prover:latest
85+
matterlabs/zksync-os-prover:${{ env.IMAGE_TAG_SHA_TS }}
86+
matterlabs/zksync-os-prover:latest
87+
88+
- name: Push docker image
89+
if: ${{ inputs.action == 'push' }}
90+
run: |
91+
docker push us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/zksync-os-prover:${{ env.IMAGE_TAG_SHA_TS }}
92+
docker push ghcr.io/${{ github.repository_owner }}/zksync-os-prover:${{ env.IMAGE_TAG_SHA_TS }}
93+
docker push ghcr.io/${{ github.repository_owner }}/zksync-os-prover:latest
94+
docker push matterlabs/zksync-os-prover:${{ env.IMAGE_TAG_SHA_TS }}
95+
docker push matterlabs/zksync-os-prover:latest
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Build and release zksync-os images
2+
on:
3+
push:
4+
branches:
5+
- zksync-os-integration
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
9+
cancel-in-progress: ${{ github.event_name != 'push' || github.ref != 'refs/heads/main' }}
10+
11+
jobs:
12+
changed_files:
13+
runs-on: ubuntu-latest
14+
name: Test changed-files
15+
outputs:
16+
core: ${{ steps.changed-files-yaml.outputs.core_any_changed }}
17+
prover: ${{ steps.changed-files-yaml.outputs.prover_any_changed }}
18+
all: ${{ steps.changed-files-yaml.outputs.all_any_changed }}
19+
steps:
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
21+
with:
22+
fetch-depth: 2
23+
24+
- name: Get all test, doc and src files that have changed
25+
id: changed-files-yaml
26+
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46
27+
with:
28+
files_yaml: |
29+
# TODO: make it more granular, as already implemented in CI workflow
30+
# We don't want to be rebuilding and redeploying all the Docker images when eg. only document have changed
31+
prover:
32+
- prover/**
33+
- core/lib/**
34+
- zkos_prover/**
35+
- '!core/lib/zksync_core_leftovers/**'
36+
core:
37+
- core/**
38+
all:
39+
- '!core/**'
40+
- '!prover/**'
41+
setup:
42+
name: Setup
43+
runs-on: [ matterlabs-deployer-stage ]
44+
outputs:
45+
image_tag_suffix: ${{ steps.generate-tag-suffix.outputs.image_tag_suffix }}
46+
prover_fri_gpu_key_id: ${{ steps.extract-prover-fri-setup-key-ids.outputs.gpu_short_commit_sha }}
47+
steps:
48+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
49+
50+
- name: Generate image tag suffix
51+
id: generate-tag-suffix
52+
run: |
53+
sha=$(git rev-parse --short HEAD)
54+
ts=$(date +%s | cut -b1-13)
55+
echo "image_tag_suffix=${sha}-${ts}" >> $GITHUB_OUTPUT
56+
57+
- name: Generate outputs with Prover FRI setup data keys IDs
58+
id: extract-prover-fri-setup-key-ids
59+
run: |
60+
./prover/extract-setup-data-keys.sh >> $GITHUB_OUTPUT
61+
62+
build-push-core-images:
63+
name: Build and push images
64+
needs: [ setup, changed_files ]
65+
uses: ./.github/workflows/build-core-template.yml
66+
if: needs.changed_files.outputs.core == 'true' || needs.changed_files.outputs.all == 'true'
67+
with:
68+
image_tag_suffix: ${{ needs.setup.outputs.image_tag_suffix }}
69+
action: "push"
70+
zksync_os: true
71+
secrets:
72+
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
73+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
74+
75+
76+
build-push-prover-images:
77+
name: Build and push images
78+
needs: [ setup, changed_files ]
79+
uses: ./.github/workflows/build-zksync-os-prover-template.yml
80+
if: needs.changed_files.outputs.prover == 'true' || needs.changed_files.outputs.all == 'true'
81+
with:
82+
image_tag_suffix: ${{ needs.setup.outputs.image_tag_suffix }}
83+
action: "push"
84+
secrets:
85+
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
86+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
87+

core/node/zkos_prover_input_generator/src/zkos_prover_input_generator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl ZkosProverInputGenerator {
253253

254254
let list_source = TxListSource { transactions };
255255
let prover_input = zk_os_forward_system::run::generate_proof_input(
256-
PathBuf::from("app_logging_enabled.bin"),
256+
PathBuf::from("execution_environment/app_logging_enabled.bin"),
257257
context,
258258
storage_commitment,
259259
tree,

docker-compose-zksync-os.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
services:
2+
reth:
3+
restart: always
4+
image: "ghcr.io/paradigmxyz/reth:v1.3.7"
5+
ulimits:
6+
nofile:
7+
soft: 1048576
8+
hard: 1048576
9+
ports:
10+
- 127.0.0.1:8545:8545
11+
volumes:
12+
- type: volume
13+
source: reth-data
14+
target: /rethdata
15+
- type: bind
16+
source: ./etc/reth/chaindata
17+
target: /chaindata
18+
19+
command: node --dev --datadir /rethdata --http --http.addr 0.0.0.0 --http.port 8545 --http.corsdomain "*" --chain /chaindata/reth_config --dev.block-time 300ms
20+
21+
postgres:
22+
image: "postgres:14"
23+
command: postgres -c 'max_connections=1000'
24+
ulimits:
25+
nofile:
26+
soft: 1048576
27+
hard: 1048576
28+
ports:
29+
- 127.0.0.1:5432:5432
30+
volumes:
31+
- type: volume
32+
source: postgres-data
33+
target: /var/lib/postgresql/data
34+
environment:
35+
# We bind only to 127.0.0.1, so setting insecure password is acceptable here
36+
- POSTGRES_PASSWORD=notsecurepassword
37+
38+
zksync-os-state-keeper:
39+
image: "matterlabs/zksync-os-server:latest"
40+
platform: linux/x86_64
41+
42+
ports:
43+
- 3124:3124
44+
volumes:
45+
- ./chains/era/configs:/configs
46+
command: --config-path=/configs/general.yaml --secrets-path=/configs/secrets.yaml --genesis-path=/configs/genesis.yaml --contracts-config-path=/configs/contracts.yaml --wallets-path=/configs/wallets.yaml --components=eth,state_keeper,zkos_prover_input_generator
47+
network_mode: host
48+
49+
zksync-os-api:
50+
image: "matterlabs/zksync-os-server:latest"
51+
platform: linux/x86_64
52+
53+
ports:
54+
- 3050:3050
55+
- 3051:3051
56+
volumes:
57+
- ./chains/era/configs:/configs
58+
command: --config-path=/configs/general.yaml --secrets-path=/configs/secrets.yaml --genesis-path=/configs/genesis.yaml --contracts-config-path=/configs/contracts.yaml --wallets-path=/configs/wallets.yaml --components=api
59+
network_mode: host
60+
61+
zksync-os-prover:
62+
image: "matterlabs/zksync-os-prover:latest"
63+
platform: linux/x86_64
64+
65+
ports:
66+
- 3052:3052
67+
command: --base-url=http://localhost:3124
68+
network_mode: host
69+
70+
71+
volumes:
72+
postgres-data:
73+
reth-data:

0 commit comments

Comments
 (0)