Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: updated local-node setup #3541

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*
!docker/prover/prover-entry.sh
!docker/local-node/entrypoint.sh
!docker/local-node/zkstack
!docker/external-node/entrypoint.sh
!docker/contract-verifier/install-all-solc.sh
!etc/test_config
Expand All @@ -25,7 +26,6 @@ keys/setup
!contracts/
!setup_2\^26.key
!setup_2\^24.key
!setup_compact.key
# It's required to remove .git from contracts,
# otherwise yarn tries to use .git parent directory that
# doesn't exist.
Expand All @@ -42,9 +42,15 @@ contracts/.git
!bellman-cuda
!prover/data/
!.github/release-please/manifest.json
!zkstack_cli
!chains
!usr/local/bin
!usr/local/bin/zkstack

!etc/env/file_based
!etc/env/dev.toml
!etc/env/consensus_secrets.yaml
!etc/env/consensus_config.yaml
!rust-toolchain
!ZkStack.yaml
!docker-compose.yml
76 changes: 67 additions & 9 deletions docker/local-node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ RUN cargo install sqlx-cli --version 0.8.0

# Copy required packages while preserving the folders structure from the repo
# It's required because these packages use relative paths to the SDK
# Copy `zk` tool
COPY infrastructure/zk /infrastructure/zk

# Copy `local-setup-preparation` tool
COPY infrastructure/local-setup-preparation /infrastructure/local-setup-preparation
# Copy dev configs
Expand All @@ -38,29 +37,34 @@ COPY etc/env /etc/env
COPY etc/test_config /etc/test_config
# Copy all the L1 contracts so they can be deployed
COPY contracts /contracts/

COPY core/ /core
# Set `ZKSYNC_HOME` to the root (required for `zk` tool)
ENV ZKSYNC_HOME=/
# Set `LOCAL_SETUP` variable to modify `zk` tool behavior
ENV ZKSYNC_LOCAL_SETUP=true
# Disable all checks
ENV ZKSYNC_ACTION=dont_ask

# Env in Docker
ENV IN_DOCKER=1
# Build all the required TS packages

# Build `zk` tool
RUN cd /infrastructure/zk && yarn && yarn build && cd /
# Build `local-setup-preparation` tool
RUN cd /infrastructure/local-setup-preparation && yarn && cd /
# RUN cd /infrastructure/local-setup-preparation && yarn && cd /
# Build L1 contracts package (contracts themselves should be already built)
RUN cd /contracts/l1-contracts && yarn && cd /
# Same for L2 contracts
RUN cd /contracts/l2-contracts && yarn && cd /
# Same for L1-da contracts
RUN cd /contracts/da-contracts && yarn && cd /

# Copy the ZK tool binary
COPY bin/zk /bin/zk
# Copy the ZK stack tool Library
COPY zkstack_cli /zkstack_cli
# Copy the configs for chain
COPY chains/era /chains/era
# Copy package json (which gives us yarn workspace - and makes commands more similar to what we normally run)
COPY package.json /
# Copy rust toolchain (so the compilation can be done with correct nightly)
COPY rust-toolchain /

# Copy DAL - needed to setup database schemas.
COPY core/lib/dal core/lib/dal
Expand All @@ -71,4 +75,58 @@ RUN mkdir /etc/env/l1-inits && mkdir /etc/env/l2-inits
# setup entrypoint script
COPY ./docker/local-node/entrypoint.sh /usr/bin/

COPY ./docker-compose.yml /docker-compose.yml
COPY ./ZkStack.yaml /ZkStack.yaml

# Install Docker
RUN apt-get update && apt-get install -y docker.io

# Configure Docker repository
# RUN apt-get update && \
# apt-get install -y ca-certificates curl gnupg && \
# mkdir -m 0755 /etc/apt/keyrings && \
# curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
# echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
# apt-get update && \
# apt-get install -y docker-compose-plugin && \
# \
# # Install Foundry for zkSync
# curl -L https://raw.githubusercontent.com/matter-labs/foundry-zksync/main/install-foundry-zksync | bash

# Persist environment variables
# ENV PATH=$HOME/.foundry/bin:$PATH
# ENV LIBCLANG_PATH=/usr/lib/llvm-14/lib
ENV COMPOSE_PROJECT_NAME=my_project_name
ENV GITHUB_WORKSPACE=my_github_workspace

# Install additional dependencies
RUN apt-get update && apt-get install -y \
clang llvm-dev libclang-dev \
ca-certificates curl gnupg \
&& curl -L https://raw.githubusercontent.com/matter-labs/foundry-zksync/main/install-foundry-zksync | bash

# Install required dependencies including Docker
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl gnupg lsb-release \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update \
&& apt-get install -y docker-compose-plugin \
&& rm -rf /var/lib/apt/lists/*

# Set persistent environment variables
ENV LIBCLANG_PATH=/usr/lib/llvm-14/lib
ENV PATH="/usr/local/cargo/bin:/root/.foundry/bin:$PATH"

RUN ./zkstack_cli/zkstackup/install -g --path ./zkstack_cli/zkstackup/zkstackup \
&& zkstackup -g --local --cargo-features gateway


# CMD ["/bin/bash"]

ENTRYPOINT ["entrypoint.sh"]



# Root hash mismatched: From config: 0xd8c9be7efb705e7dcf529c14fce7048ea99dea9eab6a6b4e5f8de1ebf4f2ebf2, Calculated 0xb6779307f23867c798513845edb67ce0eca31a433e3c86f46a6961d0567a067d
Loading
Loading