Skip to content

Commit

Permalink
Merge branch 'main' into bf-dev-setup
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoffranca committed Nov 15, 2024
2 parents c3da4f2 + 98823f9 commit eec0d1a
Show file tree
Hide file tree
Showing 263 changed files with 3,138 additions and 1,137 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/ci-core-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ jobs:
--base-token-price-denominator 1 \
--set-as-default false \
--ignore-prerequisites \
--legacy-bridge
--legacy-bridge \
--evm-emulator false
ci_run zkstack ecosystem init --dev --verbose
ci_run zkstack dev contracts --test-contracts
Expand Down Expand Up @@ -262,7 +263,8 @@ jobs:
--base-token-price-nominator 1 \
--base-token-price-denominator 1 \
--set-as-default false \
--ignore-prerequisites
--ignore-prerequisites \
--evm-emulator false
ci_run zkstack chain init \
--deploy-paymaster \
Expand All @@ -283,7 +285,8 @@ jobs:
--base-token-price-nominator 314 \
--base-token-price-denominator 1000 \
--set-as-default false \
--ignore-prerequisites
--ignore-prerequisites \
--evm-emulator false
ci_run zkstack chain init \
--deploy-paymaster \
Expand All @@ -304,7 +307,8 @@ jobs:
--base-token-price-nominator 1 \
--base-token-price-denominator 1 \
--set-as-default false \
--ignore-prerequisites
--ignore-prerequisites \
--evm-emulator false
ci_run zkstack chain build-transactions --chain offline_chain --l1-rpc-url http://127.0.0.1:8545
Expand Down Expand Up @@ -339,7 +343,8 @@ jobs:
--base-token-price-nominator 314 \
--base-token-price-denominator 1000 \
--set-as-default false \
--ignore-prerequisites
--ignore-prerequisites \
--evm-emulator false
ci_run zkstack chain init \
--deploy-paymaster \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-prover-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
ci_run zkstack prover run --component=witness-generator --round=all-rounds --docker=false &>prover_logs/witness-generator.log &
- name: Run Circuit Prover
run: |
ci_run zkstack prover run --component=circuit-prover --witness-vector-generator-count=10 --docker=false &>prover_logs/circuit_prover.log &
ci_run zkstack prover run --component=circuit-prover -l=23 -h=3 --docker=false &>prover_logs/circuit_prover.log &
- name: Wait for prover jobs to finish
env:
DATABASE_URL: postgres://postgres:notsecurepassword@localhost:5432/zksync_prover_localhost_proving_chain
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/deploy-core-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Deploy core docs

on:
push:
branches:
- "main"
tags:
- "core-v*.*.*"
paths:
- 'docs/**'
- '.github/workflows/deploy-core-docs.yml'
pull_request:
paths:
- 'docs/**'
- '.github/workflows/deploy-core-docs.yml'
workflow_dispatch:
inputs:
ref:
description: "Branch, tag or commit to deploy the core docs. If empty, use the ref that triggered the workflow."
required: false
default: ""
version:
type: string
description: "Version of the documentation to deploy"
required: false
default: "latest"

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:

deploy-core-docs:
runs-on: ubuntu-latest
permissions:
contents: write
env:
DOCS_DIR: 'docs'
PROJECT: 'core'
ENABLE_TESTS: false
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
ref: ${{ inputs.ref || '' }}

- name: Extract version from tag
if: startsWith(github.ref, 'refs/tags/')
id: extract-version
shell: 'bash -ex {0}'
run: |
TAG="${{ github.ref_name }}"
VERSION="${TAG#*-}"
echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"
- name: Deploy core docs
uses: matter-labs/deploy-mdbooks@73f638643d1be948d1002fe5433747f4a3e37a29 # v1
with:
version: ${{ inputs.version || steps.extract-version.outputs.version || github.ref_name }}
docs-dir: ${{ env.DOCS_DIR }}
github-token: ${{ secrets.GITHUB_TOKEN }}
enable-tests: ${{ env.ENABLE_TESTS }}
project: ${{ env.PROJECT }}
deploy: ${{ github.event_name != 'pull_request' }}
67 changes: 67 additions & 0 deletions .github/workflows/deploy-prover-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Deploy prover docs

on:
push:
branches:
- "main"
tags:
- "prover-v*.*.*"
paths:
- 'prover/docs/**'
- '.github/workflows/deploy-prover-docs.yml'
pull_request:
paths:
- 'prover/docs/**'
- '.github/workflows/deploy-prover-docs.yml'
workflow_dispatch:
inputs:
ref:
description: "Branch, tag or commit to deploy the prover docs. If empty, use the ref that triggered the workflow."
required: false
default: ""
version:
type: string
description: "Version of the documentation to deploy"
required: false
default: "latest"

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:

deploy-prover-docs:
runs-on: ubuntu-latest
permissions:
contents: write
env:
DOCS_DIR: 'prover/docs'
PROJECT: 'prover'
ENABLE_TESTS: false
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
ref: ${{ inputs.ref || '' }}

- name: Extract version from tag
if: startsWith(github.ref, 'refs/tags/')
id: extract-version
shell: 'bash -ex {0}'
run: |
TAG="${{ github.ref_name }}"
VERSION="${TAG#*-}"
echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"
- name: Deploy prover docs
uses: matter-labs/deploy-mdbooks@73f638643d1be948d1002fe5433747f4a3e37a29 # v1
with:
version: ${{ inputs.version || steps.extract-version.outputs.version || github.ref_name }}
docs-dir: ${{ env.DOCS_DIR }}
github-token: ${{ secrets.GITHUB_TOKEN }}
enable-tests: ${{ env.ENABLE_TESTS }}
project: ${{ env.PROJECT }}
deploy: ${{ github.event_name != 'pull_request' }}
12 changes: 12 additions & 0 deletions .github/workflows/new-build-prover-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ jobs:
- prover-job-monitor
- proof-fri-gpu-compressor
- prover-autoscaler
- circuit-prover-gpu
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
Expand Down Expand Up @@ -165,12 +166,16 @@ jobs:
tags: |
us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.components }}:2.0-${{ env.PROTOCOL_VERSION }}-${{ env.IMAGE_TAG_SHA_TS }}
matterlabs/${{ matrix.components }}:2.0-${{ env.PROTOCOL_VERSION }}-${{ env.IMAGE_TAG_SHA_TS }}
us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.components }}:2.0-${{ env.IMAGE_TAG_SHA_TS }}
matterlabs/${{ matrix.components }}:2.0-${{ env.IMAGE_TAG_SHA_TS }}
- name: Push docker image
if: ${{ inputs.action == 'push' }}
run: |
docker push us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.components }}:2.0-${{ env.PROTOCOL_VERSION }}-${{ env.IMAGE_TAG_SHA_TS }}
docker push matterlabs/${{ matrix.components }}:2.0-${{ env.PROTOCOL_VERSION }}-${{ env.IMAGE_TAG_SHA_TS }}
docker push us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.components }}:2.0-${{ env.IMAGE_TAG_SHA_TS }}
docker push matterlabs/${{ matrix.components }}:2.0-${{ env.IMAGE_TAG_SHA_TS }}
copy-images:
name: Copy images between docker registries
Expand All @@ -197,10 +202,17 @@ jobs:
docker buildx imagetools create \
--tag asia-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ env.PROTOCOL_VERSION }}-${{ inputs.image_tag_suffix }} \
us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ env.PROTOCOL_VERSION }}-${{ inputs.image_tag_suffix }}
docker buildx imagetools create \
--tag asia-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ inputs.image_tag_suffix }} \
us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ inputs.image_tag_suffix }}
- name: Login and push to Europe GAR
run: |
gcloud auth print-access-token --lifetime=7200 --impersonate-service-account=gha-ci-runners@matterlabs-infra.iam.gserviceaccount.com | docker login -u oauth2accesstoken --password-stdin https://europe-docker.pkg.dev
docker buildx imagetools create \
--tag europe-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ env.PROTOCOL_VERSION }}-${{ inputs.image_tag_suffix }} \
us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ env.PROTOCOL_VERSION }}-${{ inputs.image_tag_suffix }}
docker buildx imagetools create \
--tag europe-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ inputs.image_tag_suffix }} \
us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ inputs.image_tag_suffix }}
2 changes: 2 additions & 0 deletions .github/workflows/new-build-witness-generator-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,5 @@ jobs:
tags: |
us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.components }}:2.0-${{ env.PROTOCOL_VERSION }}-${{ env.IMAGE_TAG_SHA_TS }}
matterlabs/${{ matrix.components }}:2.0-${{ env.PROTOCOL_VERSION }}-${{ env.IMAGE_TAG_SHA_TS }}
us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.components }}:2.0-${{ env.IMAGE_TAG_SHA_TS }}
matterlabs/${{ matrix.components }}:2.0-${{ env.IMAGE_TAG_SHA_TS }}
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,12 @@ decentralization. Since it's EVM compatible (Solidity/Vyper), 99% of Ethereum pr
or re-auditing a single line of code. ZKsync Era also uses an LLVM-based compiler that will eventually let developers
write smart contracts in C++, Rust and other popular languages.

## Knowledge Index

The following questions will be answered by the following resources:

| Question | Resource |
| ------------------------------------------------------- | ---------------------------------------------- |
| What do I need to develop the project locally? | [development.md](docs/guides/development.md) |
| How can I set up my dev environment? | [setup-dev.md](docs/guides/setup-dev.md) |
| How can I run the project? | [launch.md](docs/guides/launch.md) |
| How can I build Docker images? | [build-docker.md](docs/guides/build-docker.md) |
| What is the logical project structure and architecture? | [architecture.md](docs/guides/architecture.md) |
| Where can I find protocol specs? | [specs.md](docs/specs/README.md) |
| Where can I find developer docs? | [docs](https://docs.zksync.io) |
## Documentation

The most recent documentation can be found here:

- [Core documentation](https://matter-labs.github.io/zksync-era/core/latest/)
- [Prover documentation](https://matter-labs.github.io/zksync-era/prover/latest/)

## Policies

Expand Down
19 changes: 18 additions & 1 deletion core/lib/basic_types/src/prover_dal.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Types exposed by the prover DAL for general-purpose use.
use std::{net::IpAddr, ops::Add, str::FromStr};
use std::{net::IpAddr, ops::Add, str::FromStr, time::Instant};

use chrono::{DateTime, Duration, NaiveDateTime, NaiveTime, Utc};
use serde::{Deserialize, Serialize};
Expand All @@ -18,6 +18,23 @@ pub struct FriProverJobMetadata {
pub sequence_number: usize,
pub depth: u16,
pub is_node_final_proof: bool,
pub pick_time: Instant,
}

impl FriProverJobMetadata {
/// Checks whether the metadata corresponds to a scheduler proof or not.
pub fn is_scheduler_proof(&self) -> anyhow::Result<bool> {
if self.aggregation_round == AggregationRound::Scheduler {
if self.circuit_id != 1 {
return Err(anyhow::anyhow!(
"Invalid circuit id {} for Scheduler proof",
self.circuit_id
));
}
return Ok(true);
}
Ok(false)
}
}

#[derive(Debug, Clone, Copy, Default)]
Expand Down
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book
32 changes: 32 additions & 0 deletions docs/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[book]
authors = ["ZKsync team"]
language = "en"
multilingual = false
src = "src"
title = "ZKsync Era Documentation"

[output.html]
smart-punctuation = true
mathjax-support = true
git-repository-url = "https://github.com/matter-labs/zksync-era/tree/main/docs"
edit-url-template = "https://github.com/matter-labs/zksync-era/tree/main/docs/{path}"
additional-js = ["js/version-box.js", "js/mermaid-init.js"]
additional-css = ["css/version-box.css"]

[output.html.playground]
editable = true
line-numbers = true

[output.html.search]
limit-results = 20
use-boolean-and = true
boost-title = 2
boost-hierarchy = 2
boost-paragraph = 1
expand = true
heading-split-level = 2

[preprocessor]

[preprocessor.mermaid]
command = "mdbook-mermaid"
46 changes: 46 additions & 0 deletions docs/css/version-box.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#version-box {
display: flex;
align-items: center;
margin-right: 15px; /* Space from the right side */
background-color: transparent; /* Make the box background transparent */
}

/* Base styles for the version selector */
#version-selector {
background-color: transparent; /* Remove background color */
border: 1px solid #4a5568; /* Subtle border */
border-radius: 4px; /* Rounded edges */
padding: 5px 10px; /* Padding inside dropdown */
font-size: 0.9em;
font-weight: normal;
outline: none; /* Removes default focus outline */
cursor: pointer;
}

/* Text color for dark themes */
.theme-navy #version-selector,
.theme-coal #version-selector {
color: #f7fafc; /* Light text color for dark backgrounds */
}

/* Text color for light theme */
.theme-light #version-selector {
color: #333333; /* Dark text color for light background */
}

/* Hover effect for better user feedback */
#version-selector:hover {
background-color: rgba(255, 255, 255, 0.1); /* Light hover effect */
}

/* Optional: Style for when the selector is focused */
#version-selector:focus {
border-color: #63b3ed; /* Accent color for focused state */
}

.right-buttons {
display: flex;
flex-direction: row; /* Aligns items in a row, left to right */
align-items: center; /* Centers items vertically */
gap: 10px; /* Adds space between items */
}
Loading

0 comments on commit eec0d1a

Please sign in to comment.