Skip to content

Commit

Permalink
Merge branch 'develop' into add-ca-certificates-to-bridge-history
Browse files Browse the repository at this point in the history
  • Loading branch information
sbaizet-ledger authored Aug 27, 2024
2 parents 147f5fa + 432c98b commit 3e3c9d4
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 37 deletions.
2 changes: 2 additions & 0 deletions build/dockerfiles/bridgehistoryapi-db-cli.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ RUN --mount=target=. \
# Pull db_cli into a second stage deploy alpine container
FROM alpine:latest
COPY --from=builder /bin/db_cli /bin/
RUN apk update && apk add ca-certificates
RUN update-ca-certificates
WORKDIR /app
ENTRYPOINT ["db_cli"]
2 changes: 1 addition & 1 deletion common/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime/debug"
)

var tag = "v4.4.51"
var tag = "v4.4.52"

var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
Expand Down
40 changes: 20 additions & 20 deletions prover/Cargo.lock

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

4 changes: 2 additions & 2 deletions prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ ethers-core = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "
ethers-providers = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "v2.0.7" }
halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "v1.1" }
snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", branch = "develop", default-features = false, features = ["loader_halo2", "loader_evm", "halo2-pse"] }
prover_darwin = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.12.0", package = "prover", default-features = false, features = ["parallel_syn", "scroll"] }
prover_darwin_v2 = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.13.0", package = "prover", default-features = false, features = ["parallel_syn", "scroll"] }
prover_darwin = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.12.2", package = "prover", default-features = false, features = ["parallel_syn", "scroll"] }
prover_darwin_v2 = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.13.1", package = "prover", default-features = false, features = ["parallel_syn", "scroll"] }
base64 = "0.13.1"
reqwest = { version = "0.12.4", features = ["gzip"] }
reqwest-middleware = "0.3"
Expand Down
1 change: 1 addition & 0 deletions prover/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(lazy_cell)]
#![feature(core_intrinsics)]

mod config;
mod coordinator_client;
Expand Down
1 change: 1 addition & 0 deletions prover/src/zk_circuits_handler.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mod common;
mod darwin;
mod darwin_v2;

Expand Down
19 changes: 19 additions & 0 deletions prover/src/zk_circuits_handler/common.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use std::{collections::BTreeMap, rc::Rc};

use once_cell::sync::OnceCell;

use halo2_proofs::{halo2curves::bn256::Bn256, poly::kzg::commitment::ParamsKZG};

static mut PARAMS_MAP: OnceCell<Rc<BTreeMap<u32, ParamsKZG<Bn256>>>> = OnceCell::new();

pub fn get_params_map<'a, F>(load_params_func: F) -> &'a BTreeMap<u32, ParamsKZG<Bn256>>
where
F: FnOnce() -> BTreeMap<u32, ParamsKZG<Bn256>>,
{
unsafe {
PARAMS_MAP.get_or_init(|| {
let params_map = load_params_func();
Rc::new(params_map)
})
}
}
43 changes: 36 additions & 7 deletions prover/src/zk_circuits_handler/darwin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use crate::types::{CommonHash, Task};
use std::{cell::RefCell, cmp::Ordering, env, rc::Rc};

use prover_darwin::{
aggregator::Prover as BatchProver, check_chunk_hashes, zkevm::Prover as ChunkProver,
BatchProof, BatchProvingTask, BlockTrace, BundleProof, BundleProvingTask, ChunkInfo,
ChunkProof, ChunkProvingTask,
aggregator::Prover as BatchProver, check_chunk_hashes, common::Prover as CommonProver,
zkevm::Prover as ChunkProver, BatchProof, BatchProvingTask, BlockTrace, BundleProof,
BundleProvingTask, ChunkInfo, ChunkProof, ChunkProvingTask,
};

// Only used for debugging.
Expand All @@ -39,8 +39,8 @@ fn get_block_number(block_trace: &BlockTrace) -> Option<u64> {

#[derive(Default)]
pub struct DarwinHandler {
chunk_prover: Option<RefCell<ChunkProver>>,
batch_prover: Option<RefCell<BatchProver>>,
chunk_prover: Option<RefCell<ChunkProver<'static>>>,
batch_prover: Option<RefCell<BatchProver<'static>>>,

geth_client: Option<Rc<RefCell<GethClient>>>,
}
Expand All @@ -52,15 +52,44 @@ impl DarwinHandler {
assets_dir: &str,
geth_client: Option<Rc<RefCell<GethClient>>>,
) -> Result<Self> {
let class_name = std::intrinsics::type_name::<Self>();
match prover_type {
ProverType::Chunk => Ok(Self {
chunk_prover: Some(RefCell::new(ChunkProver::from_dirs(params_dir, assets_dir))),
chunk_prover: {
let degrees = prover_darwin::config::ZKEVM_DEGREES.clone();
let params_map = super::common::get_params_map(|| {
log::info!(
"calling get_params_map from {}, prover_type: {:?}, degrees: {:?}",
class_name,
prover_type,
degrees
);
CommonProver::load_params_map(params_dir, &degrees)
});
Some(RefCell::new(ChunkProver::from_params_and_assets(
params_map, assets_dir,
)))
},
batch_prover: None,
geth_client,
}),

ProverType::Batch => Ok(Self {
batch_prover: Some(RefCell::new(BatchProver::from_dirs(params_dir, assets_dir))),
batch_prover: {
let degrees = prover_darwin::config::AGG_DEGREES.clone();
let params_map = super::common::get_params_map(|| {
log::info!(
"calling get_params_map from {}, prover_type: {:?}, degrees: {:?}",
class_name,
prover_type,
degrees
);
CommonProver::load_params_map(params_dir, &degrees)
});
Some(RefCell::new(BatchProver::from_params_and_assets(
params_map, assets_dir,
)))
},
chunk_prover: None,
geth_client,
}),
Expand Down
43 changes: 36 additions & 7 deletions prover/src/zk_circuits_handler/darwin_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use crate::types::{CommonHash, Task};
use std::{cell::RefCell, cmp::Ordering, env, rc::Rc};

use prover_darwin_v2::{
aggregator::Prover as BatchProver, check_chunk_hashes, zkevm::Prover as ChunkProver,
BatchProof, BatchProvingTask, BlockTrace, BundleProof, BundleProvingTask, ChunkInfo,
ChunkProof, ChunkProvingTask,
aggregator::Prover as BatchProver, check_chunk_hashes, common::Prover as CommonProver,
zkevm::Prover as ChunkProver, BatchProof, BatchProvingTask, BlockTrace, BundleProof,
BundleProvingTask, ChunkInfo, ChunkProof, ChunkProvingTask,
};

// Only used for debugging.
Expand All @@ -39,8 +39,8 @@ fn get_block_number(block_trace: &BlockTrace) -> Option<u64> {

#[derive(Default)]
pub struct DarwinV2Handler {
chunk_prover: Option<RefCell<ChunkProver>>,
batch_prover: Option<RefCell<BatchProver>>,
chunk_prover: Option<RefCell<ChunkProver<'static>>>,
batch_prover: Option<RefCell<BatchProver<'static>>>,

geth_client: Option<Rc<RefCell<GethClient>>>,
}
Expand All @@ -52,15 +52,44 @@ impl DarwinV2Handler {
assets_dir: &str,
geth_client: Option<Rc<RefCell<GethClient>>>,
) -> Result<Self> {
let class_name = std::intrinsics::type_name::<Self>();
match prover_type {
ProverType::Chunk => Ok(Self {
chunk_prover: Some(RefCell::new(ChunkProver::from_dirs(params_dir, assets_dir))),
chunk_prover: {
let degrees = prover_darwin_v2::config::ZKEVM_DEGREES.clone();
let params_map = super::common::get_params_map(|| {
log::info!(
"calling get_params_map from {}, prover_type: {:?}, degrees: {:?}",
class_name,
prover_type,
degrees
);
CommonProver::load_params_map(params_dir, &degrees)
});
Some(RefCell::new(ChunkProver::from_params_and_assets(
params_map, assets_dir,
)))
},
batch_prover: None,
geth_client,
}),

ProverType::Batch => Ok(Self {
batch_prover: Some(RefCell::new(BatchProver::from_dirs(params_dir, assets_dir))),
batch_prover: {
let degrees = prover_darwin_v2::config::AGG_DEGREES.clone();
let params_map = super::common::get_params_map(|| {
log::info!(
"calling get_params_map from {}, prover_type: {:?}, degrees: {:?}",
class_name,
prover_type,
degrees
);
CommonProver::load_params_map(params_dir, &degrees)
});
Some(RefCell::new(BatchProver::from_params_and_assets(
params_map, assets_dir,
)))
},
chunk_prover: None,
geth_client,
}),
Expand Down

0 comments on commit 3e3c9d4

Please sign in to comment.