Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
impv(celestia_client): move blob size limit to config
Browse files Browse the repository at this point in the history
  • Loading branch information
irnb committed Jun 28, 2024
1 parent e802f73 commit a398533
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions core/lib/config/src/configs/via_celestia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use serde::Deserialize;
pub struct ViaCelestiaConfig {
pub api_node_url: String,
pub auth_token: String,
pub blob_size_limit: usize,
}

impl ViaCelestiaConfig {
Expand All @@ -12,6 +13,7 @@ impl ViaCelestiaConfig {
Self {
api_node_url: "ws://localhost:26658".into(),
auth_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJwdWJsaWMiLCJyZWFkIiwid3JpdGUiLCJhZG1pbiJdfQ.ut1X4u9XG5cbV0yaRAKfGp9xWVrz3NoEPGGRch13dFU".into(),
blob_size_limit: 1973786,
}
}
}
1 change: 1 addition & 0 deletions core/lib/env_config/src/via_celestia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mod tests {
let config = r#"
VIA_CELESTIA_CLIENT_API_NODE_URL="ws://localhost:26658"
VIA_CELESTIA_CLIENT_AUTH_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJwdWJsaWMiLCJyZWFkIiwid3JpdGUiLCJhZG1pbiJdfQ.ut1X4u9XG5cbV0yaRAKfGp9xWVrz3NoEPGGRch13dFU
VIA_CELESTIA_CLIENT_BLOB_SIZE_LIMIT=1973786
"#;

lock.set_env(config);
Expand Down
4 changes: 3 additions & 1 deletion core/lib/via_da_clients/src/celestia/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub use zksync_config::ViaCelestiaConfig;
pub struct CelestiaClient {
light_node_url: String,
inner: Arc<Client>,
blob_size_limit: usize,
}

impl CelestiaClient {
Expand All @@ -27,6 +28,7 @@ impl CelestiaClient {
Ok(Self {
light_node_url: celestia_conf.api_node_url,
inner: Arc::new(client),
blob_size_limit: celestia_conf.blob_size_limit,
})
}
}
Expand Down Expand Up @@ -118,7 +120,7 @@ impl DataAvailabilityClient for CelestiaClient {
}

fn blob_size_limit(&self) -> Option<usize> {
Some(1973786)
Some(self.blob_size_limit)
}
}

Expand Down

0 comments on commit a398533

Please sign in to comment.