Skip to content

Commit

Permalink
Add path to points to config
Browse files Browse the repository at this point in the history
  • Loading branch information
gianbelinche committed Nov 4, 2024
1 parent f75bbad commit 862329b
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions core/lib/config/src/configs/da_client/eigen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub struct DisperserConfig {
pub wait_for_finalization: bool,
pub authenticaded: bool,
pub verify_cert: bool,
pub path_to_points: String,
}

#[derive(Clone, Debug, PartialEq)]
Expand Down
4 changes: 4 additions & 0 deletions core/lib/protobuf_config/src/da_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ impl ProtoRepr for proto::DataAvailabilityClient {
verify_cert: required(&conf.verify_cert)
.context("verify_cert")?
.clone(),
path_to_points: required(&conf.path_to_points)
.context("path_to_points")?
.clone(),
})
}
};
Expand Down Expand Up @@ -180,6 +183,7 @@ impl ProtoRepr for proto::DataAvailabilityClient {
wait_for_finalization: Some(config.wait_for_finalization),
authenticated: Some(config.authenticaded),
verify_cert: Some(config.verify_cert),
path_to_points: Some(config.path_to_points.clone()),
},
)),
})
Expand Down
1 change: 1 addition & 0 deletions core/lib/protobuf_config/src/proto/config/da_client.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ message DisperserConfig {
optional bool wait_for_finalization = 10;
optional bool authenticated = 11;
optional bool verify_cert = 12;
optional string path_to_points = 13;
}

message EigenConfig {
Expand Down
2 changes: 2 additions & 0 deletions core/node/da_clients/src/eigen/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ mod tests {
wait_for_finalization: false,
authenticaded: false,
verify_cert: true,
path_to_points: "../../../resources".to_string(),
});
let secrets = EigenSecrets {
private_key: PrivateKey::from_str(
Expand Down Expand Up @@ -149,6 +150,7 @@ mod tests {
wait_for_finalization: false,
authenticaded: true,
verify_cert: true,
path_to_points: "../../../resources".to_string(),
});
let secrets = EigenSecrets {
private_key: PrivateKey::from_str(
Expand Down
1 change: 1 addition & 0 deletions core/node/da_clients/src/eigen/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,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,
path_to_points: config.path_to_points.clone(),
};
let verifier = Verifier::new(verifier_config)
.map_err(|e| anyhow::anyhow!(format!("Failed to create verifier {:?}", e)))?;
Expand Down
16 changes: 13 additions & 3 deletions core/node/da_clients/src/eigen/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub struct VerifierConfig {
pub rpc_url: String,
pub svc_manager_addr: String,
pub max_blob_size: u32,
pub path_to_points: String,
}

#[derive(Debug, Clone)]
Expand All @@ -51,14 +52,17 @@ impl Verifier {
pub fn new(cfg: VerifierConfig) -> Result<Self, VerificationError> {
let srs_points_to_load = cfg.max_blob_size / 32;
let kzg = Kzg::setup(
"./resources/g1.point",
&format!("{}{}", cfg.path_to_points, "/g1.point"),
"",
"./resources/g2.point.powerOf2",
&format!("{}{}", cfg.path_to_points, "/g2.point.powerOf2"),
268435456, // 2 ^ 32
srs_points_to_load,
"".to_string(),
);
let kzg = kzg.map_err(|_| VerificationError::KzgError)?;
let kzg = kzg.map_err(|e| {
tracing::error!("Failed to setup KZG: {:?}", e);
VerificationError::KzgError
})?;
let url = alloy::transports::http::reqwest::Url::from_str(&cfg.rpc_url)
.map_err(|_| VerificationError::WrongUrl)?;
let provider: RootProvider<
Expand Down Expand Up @@ -351,6 +355,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,
path_to_points: "../../resources".to_string(),
})
.unwrap();
let commitment = G1Commitment {
Expand All @@ -375,6 +380,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,
path_to_points: "../../../resources".to_string(),
})
.unwrap();
let cert = BlobInfo {
Expand Down Expand Up @@ -460,6 +466,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,
path_to_points: "../../../resources".to_string(),
})
.unwrap();
let blob_header = BlobHeader {
Expand Down Expand Up @@ -501,6 +508,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,
path_to_points: "../../../resources".to_string(),
})
.unwrap();

Expand All @@ -525,6 +533,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,
path_to_points: "../../../resources".to_string(),
})
.unwrap();
let cert = BlobInfo {
Expand Down Expand Up @@ -610,6 +619,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,
path_to_points: "../../../resources".to_string(),
})
.unwrap();
let cert = BlobInfo {
Expand Down
1 change: 1 addition & 0 deletions eigenda-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ da_client:
wait_for_finalization: false
authenticated: false
verify_cert: true
path_to_points: ./resources
```
2. (optional) for using pubdata with 2MiB (as per specification), modify `etc/env/file_based/general.yaml`:
Expand Down

0 comments on commit 862329b

Please sign in to comment.