Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addda_layer flag in demp-rollup binary. #812

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/demo-rollup/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ sov-modules-api = { path = "../../module-system/sov-modules-api", features = ["n
sov-state = { path = "../../module-system/sov-state", features = ["native"] }
const-rollup-config = { path = "../const-rollup-config" }
sov-cli = { path = "../../module-system/sov-cli" }
clap = { workspace = true }

[dev-dependencies]
sov-evm = { path = "../../module-system/module-implementations/sov-evm", features = ["smart_contracts"] }
Expand All @@ -50,7 +51,6 @@ reqwest = "0.11"
tendermint = "0.32"
tempfile = { workspace = true }
proptest = { workspace = true }
clap = { workspace = true }
sov-rollup-interface = { path = "../../rollup-interface", features = ["fuzzing"] }
prometheus = "0.11.0"
prettytable-rs = "^0.10"
Expand Down
34 changes: 27 additions & 7 deletions examples/demo-rollup/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::env;
use std::str::FromStr;

use sov_demo_rollup::new_rollup_with_celestia_da;
use clap::Parser;
use sov_demo_rollup::{new_rollup_with_celestia_da, new_rollup_with_mock_da};
use tracing_subscriber::prelude::*;
use tracing_subscriber::{fmt, EnvFilter};

Expand All @@ -12,6 +12,18 @@ mod test_rpc;
/// (or a default config if not provided). Then start checking the blocks sent to the DA layer in
/// the main event loop.

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
/// The data layer type.
#[arg(long, default_value = "celestia")]
da_layer: String,

/// The path to the rollup config.
#[arg(long, default_value = "rollup_config.toml")]
rollup_config_path: String,
}

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
// Initializing logging
Expand All @@ -20,10 +32,18 @@ async fn main() -> Result<(), anyhow::Error> {
.with(EnvFilter::from_str("info,sov_sequencer=warn").unwrap())
.init();

let rollup_config_path = env::args()
.nth(1)
.unwrap_or_else(|| "rollup_config.toml".to_string());
let args = Args::parse();
let rollup_config_path = args.rollup_config_path.as_str();

let rollup = new_rollup_with_celestia_da(&rollup_config_path).await?;
rollup.run().await
match args.da_layer.as_str() {
"mock" => {
let rollup = new_rollup_with_mock_da(rollup_config_path)?;
rollup.run().await
}
"celestia" => {
let rollup = new_rollup_with_celestia_da(rollup_config_path).await?;
rollup.run().await
}
da => panic!("DA Layer not supported: {}", da),
}
}