Skip to content

Commit

Permalink
Change name to points source
Browse files Browse the repository at this point in the history
  • Loading branch information
gianbelinche committed Nov 26, 2024
1 parent aff4d11 commit 4325e5c
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 45 deletions.
8 changes: 4 additions & 4 deletions core/lib/config/src/configs/da_client/eigen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ use serde::Deserialize;
use zksync_basic_types::secrets::PrivateKey;

#[derive(Clone, Debug, PartialEq, Deserialize)]
pub enum Points {
pub enum PointsSource {
Path(String),
Link(String),
}

impl Default for Points {
impl Default for PointsSource {
fn default() -> Self {
Points::Path("".to_string())
PointsSource::Path("".to_string())
}
}
/// Configuration for the EigenDA remote disperser client.
Expand Down Expand Up @@ -37,7 +37,7 @@ pub struct EigenConfig {
/// Verify the certificate of dispatched blobs
pub verify_cert: bool,
/// Path or link to the file containing the points used for KZG
pub points: Points,
pub points_source: PointsSource,
/// Chain ID of the Ethereum network
pub chain_id: u64,
}
Expand Down
20 changes: 10 additions & 10 deletions core/lib/env_config/src/da_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ impl FromEnv for DAClientConfig {
wait_for_finalization: env::var("DA_WAIT_FOR_FINALIZATION")?.parse()?,
authenticated: env::var("DA_AUTHENTICATED")?.parse()?,
verify_cert: env::var("DA_VERIFY_CERT")?.parse()?,
points: match env::var("DA_POINTS")?.as_str() {
"Path" => zksync_config::configs::da_client::eigen::Points::Path(env::var(
"DA_POINTS_PATH",
)?),
"Link" => zksync_config::configs::da_client::eigen::Points::Link(env::var(
"DA_POINTS_LINK",
)?),
points_source: match env::var("DA_POINTS")?.as_str() {
"Path" => zksync_config::configs::da_client::eigen::PointsSource::Path(
env::var("DA_POINTS_PATH")?,
),
"Link" => zksync_config::configs::da_client::eigen::PointsSource::Link(
env::var("DA_POINTS_LINK")?,
),
_ => anyhow::bail!("Unknown Eigen points type"),
},
chain_id: env::var("DA_CHAIN_ID")?.parse()?,
Expand Down Expand Up @@ -119,7 +119,7 @@ mod tests {
configs::{
da_client::{
avail::{AvailClientConfig, AvailDefaultConfig},
eigen::Points,
eigen::PointsSource,
DAClientConfig::{self, ObjectStore},
},
object_store::ObjectStoreMode::GCS,
Expand Down Expand Up @@ -285,7 +285,7 @@ mod tests {
DA_WAIT_FOR_FINALIZATION=true
DA_AUTHENTICATED=false
DA_VERIFY_CERT=false
DA_POINTS="Path"
DA_POINTS_SOURCE="Path"
DA_POINTS_PATH="resources"
DA_CHAIN_ID=1
"#;
Expand All @@ -305,7 +305,7 @@ mod tests {
wait_for_finalization: true,
authenticated: false,
verify_cert: false,
points: Points::Path("resources".to_string()),
points_source: PointsSource::Path("resources".to_string()),
chain_id: 1
})
);
Expand Down
20 changes: 10 additions & 10 deletions core/lib/protobuf_config/src/da_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ impl ProtoRepr for proto::DataAvailabilityClient {
.context("wait_for_finalization")?,
authenticated: *required(&conf.authenticated).context("authenticated")?,
verify_cert: *required(&conf.verify_cert).context("verify_cert")?,
points: match conf.points.clone() {
Some(proto::eigen_config::Points::Path(path)) => {
points_source: match conf.points_source.clone() {
Some(proto::eigen_config::PointsSource::Path(path)) => {
let path = required(&path.path).context("path")?;
zksync_config::configs::da_client::eigen::Points::Path(path.clone())
zksync_config::configs::da_client::eigen::PointsSource::Path(path.clone())
}
Some(proto::eigen_config::Points::Link(link)) => {
Some(proto::eigen_config::PointsSource::Link(link)) => {
let link = required(&link.link).context("link")?;
zksync_config::configs::da_client::eigen::Points::Link(link.clone())
zksync_config::configs::da_client::eigen::PointsSource::Link(link.clone())
}
None => return Err(anyhow::anyhow!("Invalid Eigen DA configuration")),
},
Expand Down Expand Up @@ -136,14 +136,14 @@ impl ProtoRepr for proto::DataAvailabilityClient {
wait_for_finalization: Some(config.wait_for_finalization),
authenticated: Some(config.authenticated),
verify_cert: Some(config.verify_cert),
points: Some(match &config.points {
zksync_config::configs::da_client::eigen::Points::Path(path) => {
proto::eigen_config::Points::Path(Path {
points_source: Some(match &config.points_source {
zksync_config::configs::da_client::eigen::PointsSource::Path(path) => {
proto::eigen_config::PointsSource::Path(Path {
path: Some(path.to_string()),
})
}
zksync_config::configs::da_client::eigen::Points::Link(link) => {
proto::eigen_config::Points::Link(Link {
zksync_config::configs::da_client::eigen::PointsSource::Link(link) => {
proto::eigen_config::PointsSource::Link(Link {
link: Some(link.to_string()),
})
}
Expand Down
2 changes: 1 addition & 1 deletion core/lib/protobuf_config/src/proto/config/da_client.proto
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ message EigenConfig {
optional bool wait_for_finalization = 10;
optional bool authenticated = 11;
optional bool verify_cert = 12;
oneof points {
oneof points_source {
Path path = 13;
Link link = 14;
}
Expand Down
14 changes: 7 additions & 7 deletions core/node/da_clients/src/eigen/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl EigenClient {
#[cfg(test)]
mod tests {
use serial_test::serial;
use zksync_config::configs::da_client::eigen::Points;
use zksync_config::configs::da_client::eigen::PointsSource;
use zksync_types::secrets::PrivateKey;

use super::*;
Expand All @@ -112,7 +112,7 @@ mod tests {
wait_for_finalization: false,
authenticated: false,
verify_cert: true,
points: Points::Path("../../../resources".to_string()),
points_source: PointsSource::Path("../../../resources".to_string()),
chain_id: 17000,
};
let secrets = EigenSecrets {
Expand Down Expand Up @@ -152,7 +152,7 @@ mod tests {
wait_for_finalization: false,
authenticated: true,
verify_cert: true,
points: Points::Path("../../../resources".to_string()),
points_source: PointsSource::Path("../../../resources".to_string()),
chain_id: 17000,
};
let secrets = EigenSecrets {
Expand Down Expand Up @@ -189,7 +189,7 @@ mod tests {
wait_for_finalization: true,
authenticated: true,
verify_cert: true,
points: Points::Path("../../../resources".to_string()),
points_source: PointsSource::Path("../../../resources".to_string()),
eth_confirmation_depth: 0,
eigenda_eth_rpc: "https://ethereum-holesky-rpc.publicnode.com".to_string(),
eigenda_svc_manager_address: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(),
Expand Down Expand Up @@ -228,7 +228,7 @@ mod tests {
wait_for_finalization: true,
authenticated: true,
verify_cert: true,
points: Points::Path("../../../resources".to_string()),
points_source: PointsSource::Path("../../../resources".to_string()),
eth_confirmation_depth: 0,
eigenda_eth_rpc: "https://ethereum-holesky-rpc.publicnode.com".to_string(),
eigenda_svc_manager_address: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(),
Expand Down Expand Up @@ -266,7 +266,7 @@ mod tests {
wait_for_finalization: false,
authenticated: false,
verify_cert: true,
points: Points::Path("../../../resources".to_string()),
points_source: PointsSource::Path("../../../resources".to_string()),
chain_id: 17000,
};
let secrets = EigenSecrets {
Expand Down Expand Up @@ -306,7 +306,7 @@ mod tests {
wait_for_finalization: false,
authenticated: true,
verify_cert: true,
points: Points::Path("../../../resources".to_string()),
points_source: PointsSource::Path("../../../resources".to_string()),
chain_id: 17000,
};
let secrets = EigenSecrets {
Expand Down
2 changes: 1 addition & 1 deletion core/node/da_clients/src/eigen/eigenda-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ da_client:
wait_for_finalization: false
authenticated: false
verify_cert: true
points:
link:
link: <link_to_points>
chain_id: <your_chain_id>
```
Expand Down
2 changes: 1 addition & 1 deletion core/node/da_clients/src/eigen/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl RawEigenClient {
rpc_url: config.eigenda_eth_rpc.clone(),
svc_manager_addr: config.eigenda_svc_manager_address.clone(),
max_blob_size: config.blob_size_limit,
points: config.points.clone(),
points: config.points_source.clone(),
eth_confirmation_depth: config.eth_confirmation_depth.max(0) as u32,
private_key: hex::encode(private_key.secret_bytes()),
chain_id: config.chain_id,
Expand Down
27 changes: 16 additions & 11 deletions core/node/da_clients/src/eigen/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use ethabi::{encode, Token};
use rust_kzg_bn254::{blob::Blob, kzg::Kzg, polynomial::PolynomialFormat};
use tiny_keccak::{Hasher, Keccak};
use zksync_basic_types::web3::CallRequest;
use zksync_config::configs::da_client::eigen::Points;
use zksync_config::configs::da_client::eigen::PointsSource;
use zksync_eth_client::clients::PKSigningClient;
use zksync_types::{
url::SensitiveUrl,
Expand Down Expand Up @@ -40,7 +40,7 @@ pub struct VerifierConfig {
pub rpc_url: String,
pub svc_manager_addr: String,
pub max_blob_size: u32,
pub points: Points,
pub points: PointsSource,
pub eth_confirmation_depth: u32,
pub private_key: String,
pub chain_id: u64,
Expand Down Expand Up @@ -91,8 +91,8 @@ impl Verifier {
pub async fn new(cfg: VerifierConfig) -> Result<Self, VerificationError> {
let srs_points_to_load = cfg.max_blob_size / 32;
let path = match cfg.points.clone() {
Points::Path(path) => path,
Points::Link(link) => Self::save_points(link).await?,
PointsSource::Path(path) => path,
PointsSource::Link(link) => Self::save_points(link).await?,
};
let kzg = Kzg::setup(
&format!("{}{}", path, "/g1.point"),
Expand Down Expand Up @@ -511,7 +511,7 @@ impl Verifier {

#[cfg(test)]
mod test {
use zksync_config::configs::da_client::eigen::Points;
use zksync_config::configs::da_client::eigen::PointsSource;

use crate::eigen::blob_info::{
BatchHeader, BatchMetadata, BlobHeader, BlobInfo, BlobQuorumParam, BlobVerificationProof,
Expand All @@ -525,7 +525,8 @@ mod test {
rpc_url: "https://ethereum-holesky-rpc.publicnode.com".to_string(),
svc_manager_addr: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(),
max_blob_size: 2 * 1024 * 1024,
points: Points::Path("../../../resources".to_string()),
points: PointsSource::Path("../../../resources".to_string()),

eth_confirmation_depth: 0,
private_key: "0xd08aa7ae1bb5ddd46c3c2d8cdb5894ab9f54dec467233686ca42629e826ac4c6"
.to_string(),
Expand Down Expand Up @@ -555,7 +556,8 @@ mod test {
rpc_url: "https://ethereum-holesky-rpc.publicnode.com".to_string(),
svc_manager_addr: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(),
max_blob_size: 2 * 1024 * 1024,
points: Points::Path("../../../resources".to_string()),
points: PointsSource::Path("../../../resources".to_string()),

eth_confirmation_depth: 0,
private_key: "0xd08aa7ae1bb5ddd46c3c2d8cdb5894ab9f54dec467233686ca42629e826ac4c6"
.to_string(),
Expand Down Expand Up @@ -646,7 +648,7 @@ mod test {
rpc_url: "https://ethereum-holesky-rpc.publicnode.com".to_string(),
svc_manager_addr: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(),
max_blob_size: 2 * 1024 * 1024,
points: Points::Path("../../../resources".to_string()),
points: PointsSource::Path("../../../resources".to_string()),
eth_confirmation_depth: 0,
private_key: "0xd08aa7ae1bb5ddd46c3c2d8cdb5894ab9f54dec467233686ca42629e826ac4c6"
.to_string(),
Expand Down Expand Up @@ -693,7 +695,8 @@ mod test {
rpc_url: "https://ethereum-holesky-rpc.publicnode.com".to_string(),
svc_manager_addr: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(),
max_blob_size: 2 * 1024 * 1024,
points: Points::Path("../../../resources".to_string()),
points: PointsSource::Path("../../../resources".to_string()),

eth_confirmation_depth: 0,
private_key: "0xd08aa7ae1bb5ddd46c3c2d8cdb5894ab9f54dec467233686ca42629e826ac4c6"
.to_string(),
Expand Down Expand Up @@ -723,7 +726,8 @@ mod test {
rpc_url: "https://ethereum-holesky-rpc.publicnode.com".to_string(),
svc_manager_addr: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(),
max_blob_size: 2 * 1024 * 1024,
points: Points::Path("../../../resources".to_string()),
points: PointsSource::Path("../../../resources".to_string()),

eth_confirmation_depth: 0,
private_key: "0xd08aa7ae1bb5ddd46c3c2d8cdb5894ab9f54dec467233686ca42629e826ac4c6"
.to_string(),
Expand Down Expand Up @@ -814,7 +818,8 @@ mod test {
rpc_url: "https://ethereum-holesky-rpc.publicnode.com".to_string(),
svc_manager_addr: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(),
max_blob_size: 2 * 1024 * 1024,
points: Points::Path("../../../resources".to_string()),
points: PointsSource::Path("../../../resources".to_string()),

eth_confirmation_depth: 0,
private_key: "0xd08aa7ae1bb5ddd46c3c2d8cdb5894ab9f54dec467233686ca42629e826ac4c6"
.to_string(),
Expand Down

0 comments on commit 4325e5c

Please sign in to comment.