From 092677e9865744d7c1d3f1262d67b4627765b5ec Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:48:58 -0300 Subject: [PATCH 1/6] Change eth conf depth for settlement layer --- core/lib/config/src/configs/da_client/eigen.rs | 2 +- core/lib/protobuf_config/src/da_client.rs | 6 +++--- core/node/da_clients/src/eigen/client.rs | 16 ++++++++-------- .../src/eigen/eigenda-integration.md | 2 +- core/node/da_clients/src/eigen/sdk.rs | 3 ++- core/node/da_clients/src/eigen/verifier.rs | 18 +++++++++--------- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/core/lib/config/src/configs/da_client/eigen.rs b/core/lib/config/src/configs/da_client/eigen.rs index 6e353b6b1928..6b765d5859bd 100644 --- a/core/lib/config/src/configs/da_client/eigen.rs +++ b/core/lib/config/src/configs/da_client/eigen.rs @@ -7,7 +7,7 @@ pub struct EigenConfig { pub disperser_rpc: String, /// Block height needed to reach in order to consider the blob finalized /// a value less or equal to 0 means that the disperser will not wait for finalization - pub eth_confirmation_depth: i32, + pub settlement_layer_confirmation_depth: i32, /// URL of the Ethereum RPC server pub eigenda_eth_rpc: String, /// Address of the service manager contract diff --git a/core/lib/protobuf_config/src/da_client.rs b/core/lib/protobuf_config/src/da_client.rs index f5cff8215738..b7a800c6237c 100644 --- a/core/lib/protobuf_config/src/da_client.rs +++ b/core/lib/protobuf_config/src/da_client.rs @@ -56,8 +56,8 @@ impl ProtoRepr for proto::DataAvailabilityClient { disperser_rpc: required(&conf.disperser_rpc) .context("disperser_rpc")? .clone(), - eth_confirmation_depth: *required(&conf.eth_confirmation_depth) - .context("eth_confirmation_depth")?, + settlement_layer_confirmation_depth: *required(&conf.eth_confirmation_depth) + .context("settlement_layer_confirmation_depth")?, eigenda_eth_rpc: required(&conf.eigenda_eth_rpc) .context("eigenda_eth_rpc")? .clone(), @@ -116,7 +116,7 @@ impl ProtoRepr for proto::DataAvailabilityClient { } Eigen(config) => proto::data_availability_client::Config::Eigen(proto::EigenConfig { disperser_rpc: Some(config.disperser_rpc.clone()), - eth_confirmation_depth: Some(config.eth_confirmation_depth), + eth_confirmation_depth: Some(config.settlement_layer_confirmation_depth), eigenda_eth_rpc: Some(config.eigenda_eth_rpc.clone()), eigenda_svc_manager_address: Some(config.eigenda_svc_manager_address.clone()), blob_size_limit: Some(config.blob_size_limit), diff --git a/core/node/da_clients/src/eigen/client.rs b/core/node/da_clients/src/eigen/client.rs index aa7b701998c6..f51d2279cd25 100644 --- a/core/node/da_clients/src/eigen/client.rs +++ b/core/node/da_clients/src/eigen/client.rs @@ -102,7 +102,7 @@ mod tests { async fn test_non_auth_dispersal() { let config = EigenConfig { disperser_rpc: "https://disperser-holesky.eigenda.xyz:443".to_string(), - eth_confirmation_depth: -1, + settlement_layer_confirmation_depth: -1, 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 @@ -142,7 +142,7 @@ mod tests { async fn test_auth_dispersal() { let config = EigenConfig { disperser_rpc: "https://disperser-holesky.eigenda.xyz:443".to_string(), - eth_confirmation_depth: -1, + settlement_layer_confirmation_depth: -1, 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 @@ -189,7 +189,7 @@ mod tests { authenticated: true, verify_cert: true, path_to_points: "../../../resources".to_string(), - eth_confirmation_depth: 0, + settlement_layer_confirmation_depth: 0, eigenda_eth_rpc: "https://ethereum-holesky-rpc.publicnode.com".to_string(), eigenda_svc_manager_address: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(), chain_id: 17000, @@ -228,7 +228,7 @@ mod tests { authenticated: true, verify_cert: true, path_to_points: "../../../resources".to_string(), - eth_confirmation_depth: 0, + settlement_layer_confirmation_depth: 0, eigenda_eth_rpc: "https://ethereum-holesky-rpc.publicnode.com".to_string(), eigenda_svc_manager_address: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(), chain_id: 17000, @@ -253,10 +253,10 @@ mod tests { #[tokio::test] #[serial] - async fn test_eth_confirmation_depth() { + async fn test_settlement_layer_confirmation_depth() { let config = EigenConfig { disperser_rpc: "https://disperser-holesky.eigenda.xyz:443".to_string(), - eth_confirmation_depth: 5, + settlement_layer_confirmation_depth: 5, 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 @@ -293,10 +293,10 @@ mod tests { #[tokio::test] #[serial] - async fn test_auth_dispersal_eth_confirmation_depth() { + async fn test_auth_dispersal_settlement_layer_confirmation_depth() { let config = EigenConfig { disperser_rpc: "https://disperser-holesky.eigenda.xyz:443".to_string(), - eth_confirmation_depth: 5, + settlement_layer_confirmation_depth: 5, 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 diff --git a/core/node/da_clients/src/eigen/eigenda-integration.md b/core/node/da_clients/src/eigen/eigenda-integration.md index fa31ef596d96..38ea8982dfcd 100644 --- a/core/node/da_clients/src/eigen/eigenda-integration.md +++ b/core/node/da_clients/src/eigen/eigenda-integration.md @@ -21,7 +21,7 @@ Changes needed both for local and mainnet/testnet setup. da_client: eigen: disperser_rpc: - eth_confirmation_depth: -1 + settlement_layer_confirmation_depth: -1 eigenda_eth_rpc: eigenda_svc_manager_address: '0xD4A7E1Bd8015057293f0D0A557088c286942e84b' blob_size_limit: 2097152 diff --git a/core/node/da_clients/src/eigen/sdk.rs b/core/node/da_clients/src/eigen/sdk.rs index 6f250ba35862..b36135859b2e 100644 --- a/core/node/da_clients/src/eigen/sdk.rs +++ b/core/node/da_clients/src/eigen/sdk.rs @@ -54,7 +54,8 @@ impl RawEigenClient { svc_manager_addr: config.eigenda_svc_manager_address.clone(), max_blob_size: config.blob_size_limit, path_to_points: config.path_to_points.clone(), - eth_confirmation_depth: config.eth_confirmation_depth.max(0) as u32, + settlement_layer_confirmation_depth: config.settlement_layer_confirmation_depth.max(0) + as u32, private_key: hex::encode(private_key.secret_bytes()), chain_id: config.chain_id, }; diff --git a/core/node/da_clients/src/eigen/verifier.rs b/core/node/da_clients/src/eigen/verifier.rs index a080c58128a4..e8a193e23837 100644 --- a/core/node/da_clients/src/eigen/verifier.rs +++ b/core/node/da_clients/src/eigen/verifier.rs @@ -39,7 +39,7 @@ pub struct VerifierConfig { pub svc_manager_addr: String, pub max_blob_size: u32, pub path_to_points: String, - pub eth_confirmation_depth: u32, + pub settlement_layer_confirmation_depth: u32, pub private_key: String, pub chain_id: u64, } @@ -267,10 +267,10 @@ impl Verifier { .map_err(|_| VerificationError::ServiceManagerError)? .as_u64(); - if self.cfg.eth_confirmation_depth == 0 { + if self.cfg.settlement_layer_confirmation_depth == 0 { return Ok(latest); } - Ok(latest - (self.cfg.eth_confirmation_depth as u64 - 1)) + Ok(latest - (self.cfg.settlement_layer_confirmation_depth as u64 - 1)) } /// Verifies the certificate batch hash @@ -491,7 +491,7 @@ mod test { svc_manager_addr: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(), max_blob_size: 2 * 1024 * 1024, path_to_points: "../../../resources".to_string(), - eth_confirmation_depth: 0, + settlement_layer_confirmation_depth: 0, private_key: "0xd08aa7ae1bb5ddd46c3c2d8cdb5894ab9f54dec467233686ca42629e826ac4c6" .to_string(), chain_id: 17000, @@ -520,7 +520,7 @@ mod test { svc_manager_addr: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(), max_blob_size: 2 * 1024 * 1024, path_to_points: "../../../resources".to_string(), - eth_confirmation_depth: 0, + settlement_layer_confirmation_depth: 0, private_key: "0xd08aa7ae1bb5ddd46c3c2d8cdb5894ab9f54dec467233686ca42629e826ac4c6" .to_string(), chain_id: 17000, @@ -610,7 +610,7 @@ mod test { svc_manager_addr: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(), max_blob_size: 2 * 1024 * 1024, path_to_points: "../../../resources".to_string(), - eth_confirmation_depth: 0, + settlement_layer_confirmation_depth: 0, private_key: "0xd08aa7ae1bb5ddd46c3c2d8cdb5894ab9f54dec467233686ca42629e826ac4c6" .to_string(), chain_id: 17000, @@ -656,7 +656,7 @@ mod test { svc_manager_addr: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(), max_blob_size: 2 * 1024 * 1024, path_to_points: "../../../resources".to_string(), - eth_confirmation_depth: 0, + settlement_layer_confirmation_depth: 0, private_key: "0xd08aa7ae1bb5ddd46c3c2d8cdb5894ab9f54dec467233686ca42629e826ac4c6" .to_string(), chain_id: 17000, @@ -685,7 +685,7 @@ mod test { svc_manager_addr: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(), max_blob_size: 2 * 1024 * 1024, path_to_points: "../../../resources".to_string(), - eth_confirmation_depth: 0, + settlement_layer_confirmation_depth: 0, private_key: "0xd08aa7ae1bb5ddd46c3c2d8cdb5894ab9f54dec467233686ca42629e826ac4c6" .to_string(), chain_id: 17000, @@ -775,7 +775,7 @@ mod test { svc_manager_addr: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(), max_blob_size: 2 * 1024 * 1024, path_to_points: "../../../resources".to_string(), - eth_confirmation_depth: 0, + settlement_layer_confirmation_depth: 0, private_key: "0xd08aa7ae1bb5ddd46c3c2d8cdb5894ab9f54dec467233686ca42629e826ac4c6" .to_string(), chain_id: 17000, From 90a2b32e1c1f19fdc4747d2e12ea45bef36b031c Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:03:51 -0300 Subject: [PATCH 2/6] Remove blob size limit --- .../lib/config/src/configs/da_client/eigen.rs | 2 - core/lib/protobuf_config/src/da_client.rs | 2 - .../src/proto/config/da_client.proto | 15 ++-- core/node/da_clients/src/eigen/client.rs | 70 +++---------------- .../src/eigen/eigenda-integration.md | 1 - core/node/da_clients/src/eigen/sdk.rs | 7 +- 6 files changed, 24 insertions(+), 73 deletions(-) diff --git a/core/lib/config/src/configs/da_client/eigen.rs b/core/lib/config/src/configs/da_client/eigen.rs index 6b765d5859bd..a07d932d3dc8 100644 --- a/core/lib/config/src/configs/da_client/eigen.rs +++ b/core/lib/config/src/configs/da_client/eigen.rs @@ -12,8 +12,6 @@ pub struct EigenConfig { pub eigenda_eth_rpc: String, /// Address of the service manager contract pub eigenda_svc_manager_address: String, - /// Maximum size permitted for a blob in bytes - pub blob_size_limit: u32, /// Maximun amount of time in milliseconds to wait for a status query response pub status_query_timeout: u64, /// Interval in milliseconds to query the status of a blob diff --git a/core/lib/protobuf_config/src/da_client.rs b/core/lib/protobuf_config/src/da_client.rs index b7a800c6237c..a946c51c2175 100644 --- a/core/lib/protobuf_config/src/da_client.rs +++ b/core/lib/protobuf_config/src/da_client.rs @@ -64,7 +64,6 @@ impl ProtoRepr for proto::DataAvailabilityClient { eigenda_svc_manager_address: required(&conf.eigenda_svc_manager_address) .context("eigenda_svc_manager_address")? .clone(), - blob_size_limit: *required(&conf.blob_size_limit).context("blob_size_limit")?, status_query_timeout: *required(&conf.status_query_timeout) .context("status_query_timeout")?, status_query_interval: *required(&conf.status_query_interval) @@ -119,7 +118,6 @@ impl ProtoRepr for proto::DataAvailabilityClient { eth_confirmation_depth: Some(config.settlement_layer_confirmation_depth), eigenda_eth_rpc: Some(config.eigenda_eth_rpc.clone()), eigenda_svc_manager_address: Some(config.eigenda_svc_manager_address.clone()), - blob_size_limit: Some(config.blob_size_limit), status_query_timeout: Some(config.status_query_timeout), status_query_interval: Some(config.status_query_interval), wait_for_finalization: Some(config.wait_for_finalization), diff --git a/core/lib/protobuf_config/src/proto/config/da_client.proto b/core/lib/protobuf_config/src/proto/config/da_client.proto index ce814c5657b0..70de2ed0fa7e 100644 --- a/core/lib/protobuf_config/src/proto/config/da_client.proto +++ b/core/lib/protobuf_config/src/proto/config/da_client.proto @@ -42,14 +42,13 @@ message EigenConfig { optional int32 eth_confirmation_depth = 4; optional string eigenda_eth_rpc = 5; optional string eigenda_svc_manager_address = 6; - 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; - optional uint64 chain_id = 14; + optional uint64 status_query_timeout = 7; + optional uint64 status_query_interval = 8; + optional bool wait_for_finalization = 9; + optional bool authenticated = 10; + optional bool verify_cert = 11; + optional string path_to_points = 12; + optional uint64 chain_id = 13; } message DataAvailabilityClient { diff --git a/core/node/da_clients/src/eigen/client.rs b/core/node/da_clients/src/eigen/client.rs index f51d2279cd25..da26519c8de2 100644 --- a/core/node/da_clients/src/eigen/client.rs +++ b/core/node/da_clients/src/eigen/client.rs @@ -41,15 +41,6 @@ impl DataAvailabilityClient for EigenClient { _: u32, // batch number data: Vec, ) -> Result { - if let Some(blob_size_limit) = self.blob_size_limit() { - if data.len() > blob_size_limit { - return Err(DAError { - error: anyhow!("Blob size limit exceeded"), - is_retriable: false, - }); - } - } - let blob_id = self .client .dispatch_blob(data) @@ -79,7 +70,7 @@ impl DataAvailabilityClient for EigenClient { } fn blob_size_limit(&self) -> Option { - Some(self.client.clone().config.blob_size_limit as usize) + Some(RawEigenClient::blob_size_limit()) } } @@ -105,9 +96,8 @@ mod tests { settlement_layer_confirmation_depth: -1, 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 + status_query_timeout: 1800000, // 30 minutes + status_query_interval: 5, // 5 ms wait_for_finalization: false, authenticated: false, verify_cert: true, @@ -145,9 +135,8 @@ mod tests { settlement_layer_confirmation_depth: -1, 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 + status_query_timeout: 1800000, // 30 minutes + status_query_interval: 5, // 5 ms wait_for_finalization: false, authenticated: true, verify_cert: true, @@ -182,9 +171,8 @@ mod tests { async fn test_wait_for_finalization() { let config = EigenConfig { disperser_rpc: "https://disperser-holesky.eigenda.xyz:443".to_string(), - blob_size_limit: 2 * 1024 * 1024, // 2MB - status_query_timeout: 1800000, // 30 minutes - status_query_interval: 5000, // 5000 ms + status_query_timeout: 1800000, // 30 minutes + status_query_interval: 5000, // 5000 ms wait_for_finalization: true, authenticated: true, verify_cert: true, @@ -217,40 +205,6 @@ mod tests { assert_eq!(retrieved_data.unwrap(), data); } - #[tokio::test] - async fn test_eigenda_dispatch_blob_too_large() { - let config = EigenConfig { - disperser_rpc: "https://disperser-holesky.eigenda.xyz:443".to_string(), - blob_size_limit: 99, - 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(), - settlement_layer_confirmation_depth: 0, - eigenda_eth_rpc: "https://ethereum-holesky-rpc.publicnode.com".to_string(), - eigenda_svc_manager_address: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b".to_string(), - chain_id: 17000, - }; - let secrets = EigenSecrets { - private_key: PrivateKey::from_str( - "d08aa7ae1bb5ddd46c3c2d8cdb5894ab9f54dec467233686ca42629e826ac4c6", - ) - .unwrap(), - }; - let client = EigenClient::new(config, secrets).await.unwrap(); - let data = vec![1u8; 100]; - let actual_error = client - .dispatch_blob(0, data.clone()) - .await - .err() - .unwrap() - .error; - let expected_error = anyhow!("Blob size limit exceeded"); - assert_eq!(format!("{}", actual_error), format!("{}", expected_error)); - } - #[tokio::test] #[serial] async fn test_settlement_layer_confirmation_depth() { @@ -259,9 +213,8 @@ mod tests { settlement_layer_confirmation_depth: 5, 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 + status_query_timeout: 1800000, // 30 minutes + status_query_interval: 5, // 5 ms wait_for_finalization: false, authenticated: false, verify_cert: true, @@ -299,9 +252,8 @@ mod tests { settlement_layer_confirmation_depth: 5, 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 + status_query_timeout: 1800000, // 30 minutes + status_query_interval: 5, // 5 ms wait_for_finalization: false, authenticated: true, verify_cert: true, diff --git a/core/node/da_clients/src/eigen/eigenda-integration.md b/core/node/da_clients/src/eigen/eigenda-integration.md index 38ea8982dfcd..e15178e0fcfc 100644 --- a/core/node/da_clients/src/eigen/eigenda-integration.md +++ b/core/node/da_clients/src/eigen/eigenda-integration.md @@ -24,7 +24,6 @@ da_client: settlement_layer_confirmation_depth: -1 eigenda_eth_rpc: eigenda_svc_manager_address: '0xD4A7E1Bd8015057293f0D0A557088c286942e84b' - blob_size_limit: 2097152 status_query_timeout: 1800000 # ms status_query_interval: 5 # ms wait_for_finalization: false diff --git a/core/node/da_clients/src/eigen/sdk.rs b/core/node/da_clients/src/eigen/sdk.rs index b36135859b2e..30726d08cf26 100644 --- a/core/node/da_clients/src/eigen/sdk.rs +++ b/core/node/da_clients/src/eigen/sdk.rs @@ -40,6 +40,7 @@ pub(crate) const AVG_BLOCK_TIME: u64 = 12; impl RawEigenClient { pub(crate) const BUFFER_SIZE: usize = 1000; + const BLOB_SIZE_LIMIT: usize = 1024 * 1024 * 2; // 2 MB pub async fn new(private_key: SecretKey, config: EigenConfig) -> anyhow::Result { let endpoint = @@ -52,7 +53,7 @@ impl RawEigenClient { verify_certs: true, rpc_url: config.eigenda_eth_rpc.clone(), svc_manager_addr: config.eigenda_svc_manager_address.clone(), - max_blob_size: config.blob_size_limit, + max_blob_size: Self::BLOB_SIZE_LIMIT as u32, path_to_points: config.path_to_points.clone(), settlement_layer_confirmation_depth: config.settlement_layer_confirmation_depth.max(0) as u32, @@ -69,6 +70,10 @@ impl RawEigenClient { }) } + pub fn blob_size_limit() -> usize { + Self::BLOB_SIZE_LIMIT + } + async fn dispatch_blob_non_authenticated(&self, data: Vec) -> anyhow::Result { let padded_data = convert_by_padding_empty_byte(&data); let request = disperser::DisperseBlobRequest { From dc2dddc8e788473b914a47f9c276586c53fc15cf Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:10:38 -0300 Subject: [PATCH 3/6] Move reserved --- core/lib/protobuf_config/src/proto/config/da_client.proto | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/lib/protobuf_config/src/proto/config/da_client.proto b/core/lib/protobuf_config/src/proto/config/da_client.proto index 70de2ed0fa7e..35d3e243c24e 100644 --- a/core/lib/protobuf_config/src/proto/config/da_client.proto +++ b/core/lib/protobuf_config/src/proto/config/da_client.proto @@ -37,7 +37,6 @@ message CelestiaConfig { } message EigenConfig { - reserved 1,2; optional string disperser_rpc = 3; optional int32 eth_confirmation_depth = 4; optional string eigenda_eth_rpc = 5; @@ -49,6 +48,8 @@ message EigenConfig { optional bool verify_cert = 11; optional string path_to_points = 12; optional uint64 chain_id = 13; + reserved 1,2; + reserved "rpc_node_url","inclusion_polling_interval_ms"; } message DataAvailabilityClient { From e6616a60688699b0c179e0d54e14f24a97ca3d91 Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:16:51 -0300 Subject: [PATCH 4/6] Change function name --- core/node/da_clients/src/eigen/sdk.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/node/da_clients/src/eigen/sdk.rs b/core/node/da_clients/src/eigen/sdk.rs index 30726d08cf26..19c1c00e1b59 100644 --- a/core/node/da_clients/src/eigen/sdk.rs +++ b/core/node/da_clients/src/eigen/sdk.rs @@ -97,7 +97,7 @@ impl RawEigenClient { .verify_commitment(blob_info.blob_header.commitment.clone(), data) .map_err(|_| anyhow::anyhow!("Failed to verify commitment"))?; - self.loop_verify_certificate(blob_info.clone(), disperse_elapsed) + self.perform_verification(blob_info.clone(), disperse_elapsed) .await?; let verification_proof = blob_info.blob_verification_proof.clone(); let blob_id = format!( @@ -109,7 +109,7 @@ impl RawEigenClient { Ok(hex::encode(rlp::encode(&blob_info))) } - async fn loop_verify_certificate( + async fn perform_verification( &self, blob_info: BlobInfo, disperse_elapsed: Duration, @@ -175,7 +175,7 @@ impl RawEigenClient { .verify_commitment(blob_info.blob_header.commitment.clone(), data) .map_err(|_| anyhow::anyhow!("Failed to verify commitment"))?; - self.loop_verify_certificate(blob_info.clone(), disperse_elapsed) + self.perform_verification(blob_info.clone(), disperse_elapsed) .await?; let verification_proof = blob_info.blob_verification_proof.clone(); From 98ae8b7984a0a102f8b8c8a19f85438225956fc6 Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:22:13 -0300 Subject: [PATCH 5/6] Add constants to lib --- core/node/da_clients/src/eigen/lib.rs | 3 +++ core/node/da_clients/src/eigen/mod.rs | 1 + core/node/da_clients/src/eigen/verifier.rs | 18 +++++++++++------- 3 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 core/node/da_clients/src/eigen/lib.rs diff --git a/core/node/da_clients/src/eigen/lib.rs b/core/node/da_clients/src/eigen/lib.rs new file mode 100644 index 000000000000..46a7bc34bbd1 --- /dev/null +++ b/core/node/da_clients/src/eigen/lib.rs @@ -0,0 +1,3 @@ +pub const BATCH_ID_TO_METADATA_HASH_FUNCTION_SELECTOR: [u8; 4] = [236, 203, 191, 201]; +pub const QUORUM_ADVERSARY_THRESHOLD_PERCENTAGES_FUNCTION_SELECTOR: [u8; 4] = [134, 135, 254, 174]; +pub const QUORUM_NUMBERS_REQUIRED_FUNCTION_SELECTOR: [u8; 4] = [225, 82, 52, 255]; diff --git a/core/node/da_clients/src/eigen/mod.rs b/core/node/da_clients/src/eigen/mod.rs index a198c13e03a1..fe979becdb9f 100644 --- a/core/node/da_clients/src/eigen/mod.rs +++ b/core/node/da_clients/src/eigen/mod.rs @@ -1,5 +1,6 @@ mod blob_info; mod client; +mod lib; mod sdk; mod verifier; diff --git a/core/node/da_clients/src/eigen/verifier.rs b/core/node/da_clients/src/eigen/verifier.rs index e8a193e23837..1dbe80a6aaec 100644 --- a/core/node/da_clients/src/eigen/verifier.rs +++ b/core/node/da_clients/src/eigen/verifier.rs @@ -13,7 +13,14 @@ use zksync_types::{ }; use zksync_web3_decl::client::{Client, DynClient, L1}; -use super::blob_info::{BatchHeader, BlobHeader, BlobInfo, G1Commitment}; +use super::{ + blob_info::{BatchHeader, BlobHeader, BlobInfo, G1Commitment}, + lib::{ + BATCH_ID_TO_METADATA_HASH_FUNCTION_SELECTOR, + QUORUM_ADVERSARY_THRESHOLD_PERCENTAGES_FUNCTION_SELECTOR, + QUORUM_NUMBERS_REQUIRED_FUNCTION_SELECTOR, + }, +}; #[derive(Debug)] pub enum VerificationError { @@ -56,9 +63,6 @@ pub struct Verifier { impl Verifier { const DEFAULT_PRIORITY_FEE_PER_GAS: u64 = 100; - const BATCH_ID_TO_METADATA_HASH_FUNCTION_SELECTOR: [u8; 4] = [236, 203, 191, 201]; - const QUORUM_ADVERSARY_THRESHOLD_PERCENTAGES_FUNCTION_SELECTOR: [u8; 4] = [134, 135, 254, 174]; - const QUORUM_NUMBERS_REQUIRED_FUNCTION_SELECTOR: [u8; 4] = [225, 82, 52, 255]; pub fn new(cfg: VerifierConfig) -> Result { let srs_points_to_load = cfg.max_blob_size / 32; let kzg = Kzg::setup( @@ -277,7 +281,7 @@ impl Verifier { async fn verify_batch(&self, cert: BlobInfo) -> Result<(), VerificationError> { let context_block = self.get_context_block().await?; - let mut data = Self::BATCH_ID_TO_METADATA_HASH_FUNCTION_SELECTOR.to_vec(); + let mut data = BATCH_ID_TO_METADATA_HASH_FUNCTION_SELECTOR.to_vec(); let mut batch_id_vec = [0u8; 32]; U256::from(cert.blob_verification_proof.batch_id).to_big_endian(&mut batch_id_vec); data.append(batch_id_vec.to_vec().as_mut()); @@ -370,7 +374,7 @@ impl Verifier { &self, quorum_number: u32, ) -> Result { - let data = Self::QUORUM_ADVERSARY_THRESHOLD_PERCENTAGES_FUNCTION_SELECTOR.to_vec(); + let data = QUORUM_ADVERSARY_THRESHOLD_PERCENTAGES_FUNCTION_SELECTOR.to_vec(); let call_request = CallRequest { to: Some( @@ -435,7 +439,7 @@ impl Verifier { confirmed_quorums.insert(blob_header.blob_quorum_params[i].quorum_number, true); } - let data = Self::QUORUM_NUMBERS_REQUIRED_FUNCTION_SELECTOR.to_vec(); + let data = QUORUM_NUMBERS_REQUIRED_FUNCTION_SELECTOR.to_vec(); let call_request = CallRequest { to: Some( H160::from_str(&self.cfg.svc_manager_addr) From 5187c0539268b748a0ed9b31c81460cf2767cc9e Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:51:32 -0300 Subject: [PATCH 6/6] Fix compilation --- core/lib/env_config/src/da_client.rs | 6 ++---- core/lib/protobuf_config/src/da_client.rs | 10 +++++++--- .../protobuf_config/src/proto/config/da_client.proto | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/core/lib/env_config/src/da_client.rs b/core/lib/env_config/src/da_client.rs index 43fe451618f5..8cd7658cd1db 100644 --- a/core/lib/env_config/src/da_client.rs +++ b/core/lib/env_config/src/da_client.rs @@ -250,10 +250,9 @@ mod tests { DA_CLIENT="Eigen" DA_EIGEN_CLIENT_TYPE="Disperser" DA_DISPERSER_RPC="http://localhost:8080" - DA_ETH_CONFIRMATION_DEPTH=0 + DA_SETTLEMENT_LAYER_CONFIRMATION_DEPTH=0 DA_EIGENDA_ETH_RPC="http://localhost:8545" DA_EIGENDA_SVC_MANAGER_ADDRESS="0x123" - DA_BLOB_SIZE_LIMIT=1000 DA_STATUS_QUERY_TIMEOUT=2 DA_STATUS_QUERY_INTERVAL=3 DA_WAIT_FOR_FINALIZATION=true @@ -269,10 +268,9 @@ mod tests { actual, DAClientConfig::Eigen(EigenConfig { disperser_rpc: "http://localhost:8080".to_string(), - eth_confirmation_depth: 0, + settlement_layer_confirmation_depth: 0, eigenda_eth_rpc: "http://localhost:8545".to_string(), eigenda_svc_manager_address: "0x123".to_string(), - blob_size_limit: 1000, status_query_timeout: 2, status_query_interval: 3, wait_for_finalization: true, diff --git a/core/lib/protobuf_config/src/da_client.rs b/core/lib/protobuf_config/src/da_client.rs index a946c51c2175..210171be1875 100644 --- a/core/lib/protobuf_config/src/da_client.rs +++ b/core/lib/protobuf_config/src/da_client.rs @@ -56,8 +56,10 @@ impl ProtoRepr for proto::DataAvailabilityClient { disperser_rpc: required(&conf.disperser_rpc) .context("disperser_rpc")? .clone(), - settlement_layer_confirmation_depth: *required(&conf.eth_confirmation_depth) - .context("settlement_layer_confirmation_depth")?, + settlement_layer_confirmation_depth: *required( + &conf.settlement_layer_confirmation_depth, + ) + .context("settlement_layer_confirmation_depth")?, eigenda_eth_rpc: required(&conf.eigenda_eth_rpc) .context("eigenda_eth_rpc")? .clone(), @@ -115,7 +117,9 @@ impl ProtoRepr for proto::DataAvailabilityClient { } Eigen(config) => proto::data_availability_client::Config::Eigen(proto::EigenConfig { disperser_rpc: Some(config.disperser_rpc.clone()), - eth_confirmation_depth: Some(config.settlement_layer_confirmation_depth), + settlement_layer_confirmation_depth: Some( + config.settlement_layer_confirmation_depth, + ), eigenda_eth_rpc: Some(config.eigenda_eth_rpc.clone()), eigenda_svc_manager_address: Some(config.eigenda_svc_manager_address.clone()), status_query_timeout: Some(config.status_query_timeout), diff --git a/core/lib/protobuf_config/src/proto/config/da_client.proto b/core/lib/protobuf_config/src/proto/config/da_client.proto index 35d3e243c24e..8463629b3240 100644 --- a/core/lib/protobuf_config/src/proto/config/da_client.proto +++ b/core/lib/protobuf_config/src/proto/config/da_client.proto @@ -38,7 +38,7 @@ message CelestiaConfig { message EigenConfig { optional string disperser_rpc = 3; - optional int32 eth_confirmation_depth = 4; + optional int32 settlement_layer_confirmation_depth = 4; optional string eigenda_eth_rpc = 5; optional string eigenda_svc_manager_address = 6; optional uint64 status_query_timeout = 7;