Skip to content

Commit

Permalink
Rename generic DaServiceConfig to CelestiaConfig (Sovereign-Labs#…
Browse files Browse the repository at this point in the history
…1109)

So it is clear where it belongs
  • Loading branch information
citizen-stig authored Oct 26, 2023
1 parent 8b4eb37 commit 06c118e
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions adapters/celestia/src/da_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ impl CelestiaService {
}
}

/// Runtime configuration for the DA service
/// Runtime configuration for the [`DaService`] implementation.
#[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct DaServiceConfig {
/// The jwt used to authenticate with the Celestia rpc server
pub struct CelestiaConfig {
/// The JWT used to authenticate with the Celestia RPC server
pub celestia_rpc_auth_token: String,
/// The address of the Celestia rpc server
/// The address of the Celestia RPC server
#[serde(default = "default_rpc_addr")]
pub celestia_rpc_address: String,
/// The maximum size of a Celestia RPC response, in bytes
Expand All @@ -65,7 +65,7 @@ const fn default_request_timeout_seconds() -> u64 {
}

impl CelestiaService {
pub async fn new(config: DaServiceConfig, chain_params: RollupParams) -> Self {
pub async fn new(config: CelestiaConfig, chain_params: RollupParams) -> Self {
let client = {
let mut headers = HeaderMap::new();
headers.insert(
Expand Down Expand Up @@ -105,7 +105,7 @@ impl DaService for CelestiaService {
let rollup_namespace = self.rollup_namespace;

// Fetch the header and relevant shares via RPC
debug!("Fetching header");
debug!("Fetching header at height: {}...", height);
let header = client.header_get_by_height(height).await?;
trace!(header_result = ?header);

Expand Down Expand Up @@ -227,7 +227,7 @@ mod tests {
use wiremock::{Mock, MockServer, Request, ResponseTemplate};

use super::default_request_timeout_seconds;
use crate::da_service::{get_gas_limit_for_bytes, CelestiaService, DaServiceConfig, GAS_PRICE};
use crate::da_service::{get_gas_limit_for_bytes, CelestiaConfig, CelestiaService, GAS_PRICE};
use crate::parse_pfb_namespace;
use crate::shares::NamespaceGroup;
use crate::types::tests::{with_rollup_data, without_rollup_data};
Expand Down Expand Up @@ -268,12 +268,12 @@ mod tests {
// Last return value is namespace
async fn setup_service(
timeout_sec: Option<u64>,
) -> (MockServer, DaServiceConfig, CelestiaService, Namespace) {
) -> (MockServer, CelestiaConfig, CelestiaService, Namespace) {
// Start a background HTTP server on a random local port
let mock_server = MockServer::start().await;

let timeout_sec = timeout_sec.unwrap_or_else(default_request_timeout_seconds);
let config = DaServiceConfig {
let config = CelestiaConfig {
celestia_rpc_auth_token: "RPC_TOKEN".to_string(),
celestia_rpc_address: mock_server.uri(),
max_celestia_response_body_size: 120_000,
Expand Down
2 changes: 1 addition & 1 deletion adapters/celestia/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ mod utils;
pub mod verifier;

#[cfg(feature = "native")]
pub use da_service::{CelestiaService, DaServiceConfig};
pub use da_service::{CelestiaConfig, CelestiaService};

pub use crate::celestia::*;
2 changes: 1 addition & 1 deletion examples/demo-rollup/benches/node/rollup_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn rollup_bench(_bench: &mut Criterion) {
.sample_size(10)
.measurement_time(Duration::from_secs(20));
let rollup_config_path = "benches/node/rollup_config.toml".to_string();
let mut rollup_config: RollupConfig<sov_celestia_adapter::DaServiceConfig> =
let mut rollup_config: RollupConfig<sov_celestia_adapter::CelestiaConfig> =
from_toml_path(&rollup_config_path)
.context("Failed to read rollup configuration")
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion examples/demo-rollup/benches/node/rollup_coarse_measure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async fn main() -> Result<(), anyhow::Error> {
}

let rollup_config_path = "benches/node/rollup_config.toml".to_string();
let mut rollup_config: RollupConfig<sov_celestia_adapter::DaServiceConfig> =
let mut rollup_config: RollupConfig<sov_celestia_adapter::CelestiaConfig> =
from_toml_path(&rollup_config_path)
.context("Failed to read rollup configuration")
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion examples/demo-rollup/benches/prover/prover_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ async fn main() -> Result<(), anyhow::Error> {
}

let rollup_config_path = "benches/prover/rollup_config.toml".to_string();
let mut rollup_config: RollupConfig<sov_celestia_adapter::DaServiceConfig> =
let mut rollup_config: RollupConfig<sov_celestia_adapter::CelestiaConfig> =
from_toml_path(&rollup_config_path)
.context("Failed to read rollup configuration")
.unwrap();
Expand Down
4 changes: 2 additions & 2 deletions examples/demo-rollup/src/celestia_rollup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use async_trait::async_trait;
use demo_stf::genesis_config::StorageConfig;
use demo_stf::runtime::Runtime;
use sov_celestia_adapter::verifier::{CelestiaSpec, CelestiaVerifier, RollupParams};
use sov_celestia_adapter::{CelestiaService, DaServiceConfig};
use sov_celestia_adapter::{CelestiaConfig, CelestiaService};
use sov_modules_api::default_context::{DefaultContext, ZkDefaultContext};
use sov_modules_api::Spec;
use sov_modules_rollup_template::{RollupTemplate, WalletTemplate};
Expand All @@ -21,7 +21,7 @@ pub struct CelestiaDemoRollup {}
impl RollupTemplate for CelestiaDemoRollup {
type DaService = CelestiaService;
type DaSpec = CelestiaSpec;
type DaConfig = DaServiceConfig;
type DaConfig = CelestiaConfig;
type Vm = Risc0Host<'static>;

type ZkContext = ZkDefaultContext;
Expand Down
2 changes: 1 addition & 1 deletion examples/demo-rollup/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async fn new_rollup_with_celestia_da(
rollup_config_path
);

let rollup_config: RollupConfig<sov_celestia_adapter::DaServiceConfig> =
let rollup_config: RollupConfig<sov_celestia_adapter::CelestiaConfig> =
from_toml_path(rollup_config_path).context("Failed to read rollup configuration")?;

let mock_rollup = CelestiaDemoRollup {};
Expand Down
4 changes: 2 additions & 2 deletions full-node/sov-stf-runner/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ mod tests {

let config_file = create_config_from(config);

let config: RollupConfig<sov_celestia_adapter::DaServiceConfig> =
let config: RollupConfig<sov_celestia_adapter::CelestiaConfig> =
from_toml_path(config_file.path()).unwrap();
let expected = RollupConfig {
runner: RunnerConfig {
Expand All @@ -100,7 +100,7 @@ mod tests {
},
},

da: sov_celestia_adapter::DaServiceConfig {
da: sov_celestia_adapter::CelestiaConfig {
celestia_rpc_auth_token: "SECRET_RPC_TOKEN".to_string(),
celestia_rpc_address: "http://localhost:11111/".into(),
max_celestia_response_body_size: 980,
Expand Down

0 comments on commit 06c118e

Please sign in to comment.