Skip to content

Commit

Permalink
feat(eigen-client-extra-features): Verifier (#326)
Browse files Browse the repository at this point in the history
* initial commit

* Add tests

* Add memstore

* Add assert to tests

* Add rest of memstore

* Address pr comments

* Remove to retriable error

* Fix conflicts

* Add verifier

* Fix verifier

* Add path to points to config

* Fix typo

* Fix eigenda env test

* Fix verifier test

* Move eigendaservicemanager to generated

* Remove unneeded imports

* Document verifier

* Modify errors

* Address comments

* Fix conflicts

---------

Co-authored-by: Juan Munoz <[email protected]>
  • Loading branch information
gianbelinche and juan518munoz authored Nov 5, 2024
1 parent f95bc1b commit 9c06b40
Show file tree
Hide file tree
Showing 16 changed files with 12,537 additions and 97 deletions.
1,332 changes: 1,267 additions & 65 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion core/lib/config/src/configs/da_client/eigen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ pub struct DisperserConfig {
pub eth_confirmation_depth: i32,
pub eigenda_eth_rpc: String,
pub eigenda_svc_manager_address: String,
pub blob_size_limit: u64,
pub blob_size_limit: u32,
pub status_query_timeout: u64,
pub status_query_interval: u64,
pub wait_for_finalization: bool,
pub authenticated: bool,
pub verify_cert: bool,
pub path_to_points: String,
}

#[derive(Clone, Debug, PartialEq)]
Expand Down
4 changes: 4 additions & 0 deletions core/lib/env_config/src/da_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ mod tests {
DA_STATUS_QUERY_INTERVAL=3
DA_WAIT_FOR_FINALIZATION=true
DA_AUTHENTICATED=false
DA_VERIFY_CERT=false
DA_PATH_TO_POINTS="resources"
"#;
lock.set_env(config);

Expand All @@ -315,6 +317,8 @@ mod tests {
status_query_interval: 3,
wait_for_finalization: true,
authenticated: false,
verify_cert: false,
path_to_points: "resources".to_string(),
}))
);
}
Expand Down
8 changes: 8 additions & 0 deletions core/lib/protobuf_config/src/da_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ impl ProtoRepr for proto::DataAvailabilityClient {
authenticated: required(&conf.authenticated)
.context("authenticated")?
.clone(),
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 @@ -176,6 +182,8 @@ impl ProtoRepr for proto::DataAvailabilityClient {
status_query_interval: Some(config.status_query_interval),
wait_for_finalization: Some(config.wait_for_finalization),
authenticated: Some(config.authenticated),
verify_cert: Some(config.verify_cert),
path_to_points: Some(config.path_to_points.clone()),
},
)),
})
Expand Down
4 changes: 3 additions & 1 deletion core/lib/protobuf_config/src/proto/config/da_client.proto
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ message DisperserConfig {
optional int32 eth_confirmation_depth = 4;
optional string eigenda_eth_rpc = 5;
optional string eigenda_svc_manager_address = 6;
optional uint64 blob_size_limit = 7;
optional uint32 blob_size_limit = 7;
optional uint64 status_query_timeout = 8;
optional uint64 status_query_interval = 9;
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
6 changes: 6 additions & 0 deletions core/node/da_clients/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,9 @@ rlp.workspace = true
kzgpad-rs = { git = "https://github.com/Layr-Labs/kzgpad-rs.git", tag = "v0.1.0" }
rand.workspace = true
sha3.workspace = true
tiny-keccak.workspace = true
alloy = { version = "0.3", features = ["full"] }
ethabi = "16.0.0"
rust-kzg-bn254 = {git = "https://github.com/lambdaclass/rust-kzg-bn254", branch = "bump-ark"}
ark-bn254 = "0.5.0-alpha.0"
num-bigint = "0.4.6"
14 changes: 7 additions & 7 deletions core/node/da_clients/src/eigen/blob_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl fmt::Display for ConversionError {
}
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub struct G1Commitment {
pub x: Vec<u8>,
pub y: Vec<u8>,
Expand Down Expand Up @@ -69,7 +69,7 @@ impl From<DisperserG1Commitment> for G1Commitment {
}
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub struct BlobQuorumParam {
pub quorum_number: u32,
pub adversary_threshold_percentage: u32,
Expand Down Expand Up @@ -121,7 +121,7 @@ impl From<DisperserBlobQuorumParam> for BlobQuorumParam {
}
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub struct BlobHeader {
pub commitment: G1Commitment,
pub data_length: u32,
Expand Down Expand Up @@ -186,7 +186,7 @@ impl TryFrom<DisperserBlobHeader> for BlobHeader {
}
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub struct BatchHeader {
pub batch_root: Vec<u8>,
pub quorum_numbers: Vec<u8>,
Expand Down Expand Up @@ -241,7 +241,7 @@ impl From<DisperserBatchHeader> for BatchHeader {
}
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub struct BatchMetadata {
pub batch_header: BatchHeader,
pub signatory_record_hash: Vec<u8>,
Expand Down Expand Up @@ -302,7 +302,7 @@ impl TryFrom<DisperserBatchMetadata> for BatchMetadata {
}
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub struct BlobVerificationProof {
pub batch_id: u32,
pub blob_index: u32,
Expand Down Expand Up @@ -365,7 +365,7 @@ impl TryFrom<DisperserBlobVerificationProof> for BlobVerificationProof {
}
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub struct BlobInfo {
pub blob_header: BlobHeader,
pub blob_verification_proof: BlobVerificationProof,
Expand Down
17 changes: 11 additions & 6 deletions core/node/da_clients/src/eigen/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,15 @@ mod tests {
custom_quorum_numbers: None,
disperser_rpc: "https://disperser-holesky.eigenda.xyz:443".to_string(),
eth_confirmation_depth: -1,
eigenda_eth_rpc: String::default(),
eigenda_eth_rpc: "https://ethereum-holesky-rpc.publicnode.com".to_string(),
eigenda_svc_manager_address: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(),
blob_size_limit: 2 * 1024 * 1024, // 2MB
status_query_timeout: 1800000, // 30 minutes
status_query_interval: 5, // 5 ms
wait_for_finalization: false,
authenticated: false,
verify_cert: true,
path_to_points: "../../../resources".to_string(),
});
let secrets = EigenSecrets {
private_key: PrivateKey::from_str(
Expand Down Expand Up @@ -154,13 +156,15 @@ mod tests {
custom_quorum_numbers: None,
disperser_rpc: "https://disperser-holesky.eigenda.xyz:443".to_string(),
eth_confirmation_depth: -1,
eigenda_eth_rpc: String::default(),
eigenda_eth_rpc: "https://ethereum-holesky-rpc.publicnode.com".to_string(),
eigenda_svc_manager_address: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(),
blob_size_limit: 2 * 1024 * 1024, // 2MB
status_query_timeout: 1800000, // 30 minutes
status_query_interval: 5, // 5 ms
wait_for_finalization: false,
authenticated: true,
verify_cert: true,
path_to_points: "../../../resources".to_string(),
});
let secrets = EigenSecrets {
private_key: PrivateKey::from_str(
Expand Down Expand Up @@ -217,20 +221,21 @@ mod tests {
let retrieved_data = client.get_blob_data(&result.blob_id).await.unwrap();
assert_eq!(retrieved_data.unwrap(), data);
}

#[tokio::test]
async fn test_wait_for_finalization() {
let config = EigenConfig::Disperser(DisperserConfig {
custom_quorum_numbers: None,
disperser_rpc: "https://disperser-holesky.eigenda.xyz:443".to_string(),
eth_confirmation_depth: -1,
eigenda_eth_rpc: String::default(),
eigenda_svc_manager_address: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(),
blob_size_limit: 2 * 1024 * 1024, // 2MB
status_query_timeout: 1800000, // 30 minutes
status_query_interval: 5000, // 5000 ms
wait_for_finalization: true,
authenticated: true,
verify_cert: true,
path_to_points: "../../../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(),
});
let secrets = EigenSecrets {
private_key: PrivateKey::from_str(
Expand Down
Loading

0 comments on commit 9c06b40

Please sign in to comment.