Skip to content

Commit

Permalink
Code review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
bkolad committed Aug 18, 2023
1 parent 0a60997 commit 9fbf772
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
10 changes: 10 additions & 0 deletions examples/demo-rollup/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::env;

use sov_demo_rollup::new_rollup_with_celestia_da;
use tracing::Level;

#[cfg(test)]
mod test_rpc;
Expand All @@ -11,6 +12,15 @@ mod test_rpc;
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
// Initializing logging
let subscriber = tracing_subscriber::fmt()
.with_max_level(Level::INFO)
.finish();

tracing::subscriber::set_global_default(subscriber)
.map_err(|_err| eprintln!("Unable to set global default subscriber"))
.expect("Cannot fail to set subscriber");

let rollup_config_path = env::args()
.nth(1)
.unwrap_or_else(|| "rollup_config.toml".to_string());
Expand Down
14 changes: 3 additions & 11 deletions examples/demo-rollup/src/rollup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ use sov_rollup_interface::services::da::DaService;
use sov_rollup_interface::zk::Zkvm;
use sov_state::storage::Storage;
use sov_stf_runner::{from_toml_path, RollupConfig, RunnerConfig, StateTransitionRunner};
use tracing::{debug, Level};
use tracing::debug;

#[cfg(feature = "experimental")]
use crate::register_rpc::register_ethereum;
use crate::register_rpc::{register_ledger, register_sequencer};
use crate::{get_genesis_config, initialize_ledger, ROLLUP_NAMESPACE};

/// Dependencies needed to run the rollup.
pub struct Rollup<Vm: Zkvm, DA: DaService> {
pub struct Rollup<Vm: Zkvm, DA: DaService + Clone> {
app: App<Vm, DA::Spec>,
da_service: DA,
ledger_db: LedgerDB,
Expand All @@ -32,14 +32,6 @@ pub async fn new_rollup_with_celestia_da(
let rollup_config: RollupConfig<celestia::DaServiceConfig> =
from_toml_path(rollup_config_path).context("Failed to read rollup configuration")?;

// Initializing logging
let subscriber = tracing_subscriber::fmt()
.with_max_level(Level::INFO)
.finish();
tracing::subscriber::set_global_default(subscriber)
.map_err(|_err| eprintln!("Unable to set global default subscriber"))
.expect("Cannot fail to set subscriber");

let ledger_db = initialize_ledger(&rollup_config.storage.path);

let da_service = CelestiaService::new(
Expand All @@ -60,7 +52,7 @@ pub async fn new_rollup_with_celestia_da(
})
}

impl<Vm: Zkvm, DA: DaService<Error = anyhow::Error>> Rollup<Vm, DA> {
impl<Vm: Zkvm, DA: DaService<Error = anyhow::Error> + Clone> Rollup<Vm, DA> {
/// Runs the rollup.
pub async fn run(mut self) -> Result<(), anyhow::Error> {
let storage = self.app.get_storage();
Expand Down
2 changes: 1 addition & 1 deletion rollup-interface/src/node/services/da.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::zk::ValidityCondition;
/// The DaService has two responsibilities - fetching data from the DA layer, transforming the
/// data into a representation that can be efficiently verified in circuit.
#[async_trait]
pub trait DaService: Clone + Send + Sync + 'static {
pub trait DaService: Send + Sync + 'static {
/// A handle to the types used by the DA layer.
type RuntimeConfig: DeserializeOwned;

Expand Down

0 comments on commit 9fbf772

Please sign in to comment.