Skip to content

Commit

Permalink
Merge branch 'main' into aov-pla-1065-protect-against-races-in-ci-int…
Browse files Browse the repository at this point in the history
…egration-tests
  • Loading branch information
slowli authored Nov 11, 2024
2 parents 987c324 + 8b31a85 commit 4aac0f7
Show file tree
Hide file tree
Showing 321 changed files with 2,437 additions and 1,710 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/release-test-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ jobs:
build-push-core-images:
name: Build and push images
needs: [setup, changed_files]
uses: ./.github/workflows/build-core-template.yml
uses: ./.github/workflows/new-build-core-template.yml
if: needs.changed_files.outputs.core == 'true' || needs.changed_files.outputs.all == 'true'
with:
image_tag_suffix: ${{ needs.setup.outputs.image_tag_suffix }}
action: "push"
secrets:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -84,37 +85,40 @@ jobs:
build-push-contract-verifier:
name: Build and push images
needs: [setup, changed_files]
uses: ./.github/workflows/build-contract-verifier-template.yml
uses: ./.github/workflows/new-build-contract-verifier-template.yml
if: needs.changed_files.outputs.core == 'true' || needs.changed_files.outputs.all == 'true'
with:
image_tag_suffix: ${{ needs.setup.outputs.image_tag_suffix }}
action: "push"
secrets:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

build-push-prover-images:
name: Build and push images
needs: [setup, changed_files]
uses: ./.github/workflows/build-prover-template.yml
uses: ./.github/workflows/new-build-prover-template.yml
if: needs.changed_files.outputs.prover == 'true' || needs.changed_files.outputs.all == 'true'
with:
image_tag_suffix: ${{ needs.setup.outputs.image_tag_suffix }}
ERA_BELLMAN_CUDA_RELEASE: ${{ vars.ERA_BELLMAN_CUDA_RELEASE }}
CUDA_ARCH: "60;70;75;80;89"
action: "push"
secrets:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

build-push-witness-generator-image-avx512:
name: Build and push prover images with avx512 instructions
needs: [setup, changed_files]
uses: ./.github/workflows/build-witness-generator-template.yml
uses: ./.github/workflows/new-build-witness-generator-template.yml
if: needs.changed_files.outputs.prover == 'true' || needs.changed_files.outputs.all == 'true'
with:
image_tag_suffix: ${{ needs.setup.outputs.image_tag_suffix }}-avx512
ERA_BELLMAN_CUDA_RELEASE: ${{ vars.ERA_BELLMAN_CUDA_RELEASE }}
CUDA_ARCH: "60;70;75;80;89"
WITNESS_GENERATOR_RUST_FLAGS: "-Ctarget_feature=+avx512bw,+avx512cd,+avx512dq,+avx512f,+avx512vl "
action: push
secrets:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
35 changes: 7 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ google-cloud-storage = "0.20.0"
governor = "0.4.2"
hex = "0.4"
http = "1.1"
http-body-util = "0.1.2"
httpmock = "0.7.0"
hyper = "1.3"
insta = "1.29.0"
Expand Down
11 changes: 6 additions & 5 deletions bin/run_loadtest_from_github_actions
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ export TRANSACTION_WEIGHTS_WITHDRAWAL=${weights[3]}

read -ra execution_params <<<"$CONTRACT_EXECUTION_PARAMS" #reading $CONTRACT_EXECUTION_PARAMS as an array as tokens separated by IFS
export CONTRACT_EXECUTION_PARAMS_READS=${execution_params[0]}
export CONTRACT_EXECUTION_PARAMS_WRITES=${execution_params[1]}
export CONTRACT_EXECUTION_PARAMS_EVENTS=${execution_params[2]}
export CONTRACT_EXECUTION_PARAMS_HASHES=${execution_params[3]}
export CONTRACT_EXECUTION_PARAMS_RECURSIVE_CALLS=${execution_params[4]}
export CONTRACT_EXECUTION_PARAMS_DEPLOYS=${execution_params[5]}
export CONTRACT_EXECUTION_PARAMS_INITIAL_WRITES=${execution_params[1]}
export CONTRACT_EXECUTION_PARAMS_REPEATED_WRITES=${execution_params[2]}
export CONTRACT_EXECUTION_PARAMS_EVENTS=${execution_params[3]}
export CONTRACT_EXECUTION_PARAMS_HASHES=${execution_params[4]}
export CONTRACT_EXECUTION_PARAMS_RECURSIVE_CALLS=${execution_params[5]}
export CONTRACT_EXECUTION_PARAMS_DEPLOYS=${execution_params[6]}

# Run the test
cargo run --bin loadnext
5 changes: 1 addition & 4 deletions core/bin/contract-verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ publish = false

[dependencies]
zksync_dal.workspace = true
zksync_env_config.workspace = true
zksync_config = { workspace = true, features = ["observability_ext"] }
zksync_contract_verifier_lib.workspace = true
zksync_queued_job_processor.workspace = true
Expand All @@ -21,8 +20,6 @@ zksync_vlog.workspace = true
zksync_core_leftovers.workspace = true

anyhow.workspace = true
clap = { workspace = true, features = ["derive"] }
tokio = { workspace = true, features = ["full"] }
futures.workspace = true
ctrlc.workspace = true
structopt.workspace = true
tracing.workspace = true
53 changes: 18 additions & 35 deletions core/bin/contract-verifier/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::{cell::RefCell, time::Duration};
use std::{path::PathBuf, time::Duration};

use anyhow::Context;
use futures::{channel::mpsc, executor::block_on, SinkExt, StreamExt};
use structopt::StructOpt;
use anyhow::Context as _;
use clap::Parser;
use tokio::sync::watch;
use zksync_config::configs::PrometheusConfig;
use zksync_contract_verifier_lib::ContractVerifier;
Expand All @@ -12,27 +11,31 @@ use zksync_queued_job_processor::JobProcessor;
use zksync_utils::wait_for_tasks::ManagedTasks;
use zksync_vlog::prometheus::PrometheusExporterConfig;

#[derive(StructOpt)]
#[structopt(name = "ZKsync contract code verifier", author = "Matter Labs")]
#[derive(Debug, Parser)]
#[command(name = "ZKsync contract code verifier", author = "Matter Labs")]
struct Opt {
/// Number of jobs to process. If None, runs indefinitely.
#[structopt(long)]
#[arg(long)]
jobs_number: Option<usize>,
/// Path to the configuration file.
#[structopt(long)]
config_path: Option<std::path::PathBuf>,
#[arg(long)]
config_path: Option<PathBuf>,
/// Path to the secrets file.
#[structopt(long)]
secrets_path: Option<std::path::PathBuf>,
#[arg(long)]
secrets_path: Option<PathBuf>,
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
let opt = Opt::from_args();
let opt = Opt::parse();

let general_config = load_general_config(opt.config_path).context("general config")?;
let database_secrets = load_database_secrets(opt.secrets_path).context("database secrets")?;
let observability_config = general_config
.observability
.context("ObservabilityConfig")?;
let _observability_guard = observability_config.install()?;

let database_secrets = load_database_secrets(opt.secrets_path).context("database secrets")?;
let verifier_config = general_config
.contract_verifier
.context("ContractVerifierConfig")?;
Expand All @@ -46,33 +49,13 @@ async fn main() -> anyhow::Result<()> {
.context("Master DB URL is absent")?,
)
.build()
.await
.unwrap();

let observability_config = general_config
.observability
.context("ObservabilityConfig")?;

let _observability_guard = observability_config.install()?;
.await?;

let (stop_sender, stop_receiver) = watch::channel(false);
let (stop_signal_sender, mut stop_signal_receiver) = mpsc::channel(256);
{
let stop_signal_sender = RefCell::new(stop_signal_sender.clone());
ctrlc::set_handler(move || {
let mut sender = stop_signal_sender.borrow_mut();
block_on(sender.send(true)).expect("Ctrl+C signal send");
})
.expect("Error setting Ctrl+C handler");
}

let contract_verifier = ContractVerifier::new(verifier_config.compilation_timeout(), pool)
.await
.context("failed initializing contract verifier")?;
let tasks = vec![
// TODO PLA-335: Leftovers after the prover DB split.
// The prover connection pool is not used by the contract verifier, but we need to pass it
// since `JobProcessor` trait requires it.
tokio::spawn(contract_verifier.run(stop_receiver.clone(), opt.jobs_number)),
tokio::spawn(
PrometheusExporterConfig::pull(prometheus_config.listener_port).run(stop_receiver),
Expand All @@ -82,7 +65,7 @@ async fn main() -> anyhow::Result<()> {
let mut tasks = ManagedTasks::new(tasks);
tokio::select! {
() = tasks.wait_single() => {},
_ = stop_signal_receiver.next() => {
_ = tokio::signal::ctrl_c() => {
tracing::info!("Stop signal received, shutting down");
},
};
Expand Down
1 change: 0 additions & 1 deletion core/bin/external_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ zksync_config.workspace = true
zksync_protobuf_config.workspace = true
zksync_eth_client.workspace = true
zksync_storage.workspace = true
zksync_utils.workspace = true
zksync_state.workspace = true
zksync_contracts.workspace = true
zksync_l1_contract_interface.workspace = true
Expand Down
Loading

0 comments on commit 4aac0f7

Please sign in to comment.